More test cases for Bootstrap
This commit is contained in:
parent
a421f94909
commit
bd51f12fb7
@ -205,7 +205,7 @@ public class BootstrapTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldUpdateOptionMapAsRequested() {
|
public void shouldUpdateOptionMapAsRequested1() {
|
||||||
Bootstrap b = new Bootstrap();
|
Bootstrap b = new Bootstrap();
|
||||||
b.setOption("s", "x");
|
b.setOption("s", "x");
|
||||||
b.setOption("b", true);
|
b.setOption("b", true);
|
||||||
@ -218,6 +218,25 @@ public class BootstrapTest {
|
|||||||
assertEquals(42, o.get("i"));
|
assertEquals(42, o.get("i"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldUpdateOptionMapAsRequested2() {
|
||||||
|
Bootstrap b = new Bootstrap();
|
||||||
|
Map<String, Object> o1 = new HashMap<String, Object>();
|
||||||
|
o1.put("s", "x");
|
||||||
|
o1.put("b", true);
|
||||||
|
o1.put("i", 42);
|
||||||
|
b.setOptions(o1);
|
||||||
|
|
||||||
|
Map<String, Object> o2 = b.getOptions();
|
||||||
|
assertEquals(3, o2.size());
|
||||||
|
assertEquals("x", o2.get("s"));
|
||||||
|
assertEquals(true, o2.get("b"));
|
||||||
|
assertEquals(42, o2.get("i"));
|
||||||
|
|
||||||
|
assertNotSame(o1, o2);
|
||||||
|
assertEquals(o1, o2);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldRemoveOptionIfValueIsNull() {
|
public void shouldRemoveOptionIfValueIsNull() {
|
||||||
Bootstrap b = new Bootstrap();
|
Bootstrap b = new Bootstrap();
|
||||||
@ -229,4 +248,19 @@ public class BootstrapTest {
|
|||||||
assertNull(b.getOption("s"));
|
assertNull(b.getOption("s"));
|
||||||
assertTrue(b.getOptions().isEmpty());
|
assertTrue(b.getOptions().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected = NullPointerException.class)
|
||||||
|
public void shouldNotAllowNullOptionKeyOnGet() {
|
||||||
|
new Bootstrap().getOption(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = NullPointerException.class)
|
||||||
|
public void shouldNotAllowNullOptionKeyOnSet() {
|
||||||
|
new Bootstrap().setOption(null, "x");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = NullPointerException.class)
|
||||||
|
public void shouldNotAllowNullOptionMap() {
|
||||||
|
new Bootstrap().setOptions(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user