A couple more test cases for Bootstrap

This commit is contained in:
Trustin Lee 2008-08-18 02:54:03 +00:00
parent 82f4d193b1
commit a421f94909

View File

@ -61,7 +61,10 @@ public class BootstrapTest {
@Test @Test
public void shouldNotAllowFactoryToChangeMoreThanOnce() { public void shouldNotAllowFactoryToChangeMoreThanOnce() {
Bootstrap b = new Bootstrap(); Bootstrap b = new Bootstrap();
b.setFactory(createMock(ChannelFactory.class)); ChannelFactory f = createMock(ChannelFactory.class);
b.setFactory(f);
assertSame(f, b.getFactory());
try { try {
b.setFactory(createMock(ChannelFactory.class)); b.setFactory(createMock(ChannelFactory.class));
fail(); fail();
@ -220,9 +223,10 @@ public class BootstrapTest {
Bootstrap b = new Bootstrap(); Bootstrap b = new Bootstrap();
b.setOption("s", "x"); b.setOption("s", "x");
assertEquals("x", b.getOptions().get("s")); assertEquals("x", b.getOption("s"));
b.setOption("s", null); b.setOption("s", null);
assertNull(b.getOption("s"));
assertTrue(b.getOptions().isEmpty()); assertTrue(b.getOptions().isEmpty());
} }
} }