Skip to content

Commit

Permalink
add test in the builder
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Nov 8, 2022
1 parent b06ae96 commit 447a77e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Collections;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.function.Supplier;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand All @@ -30,12 +31,15 @@ public class SettingsBuilderTest {

@Test
public void shouldReturnErrorWhenKeyIsNUll() {
Assertions.assertThrows(NullPointerException.class, () -> Settings.builder().put(null, "value"));
Assertions.assertThrows(NullPointerException.class, () -> Settings.builder().put((String) null, "value"));
Assertions.assertThrows(NullPointerException.class, () -> Settings.builder().put((Supplier<String>) null,
"value"));
}

@Test
public void shouldReturnErrorWhenValueIsNUll() {
Assertions.assertThrows(NullPointerException.class, () -> Settings.builder().put("key", null));
Assertions.assertThrows(NullPointerException.class, () -> Settings.builder().put(() -> "key", null));
}

@Test
Expand Down

0 comments on commit 447a77e

Please sign in to comment.