@Test public void testSetConfiguration() throws Throwable { ChannelPool channelPool = new ChannelPool(); Configuration cfg = new SimpleConfiguration(); channelPool.setConfiguration(cfg); assertSame("channelPool.cfg", cfg, channelPool.cfg); }
@Test public void testSetConfigurationThrowsNullPointerException() throws Throwable { ChannelPool channelPool = new ChannelPool(); Configuration cfg = new SubConfiguration(); try { channelPool.setConfiguration(cfg); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertSame("channelPool.cfg", cfg, channelPool.cfg); assertNull("ex.getMessage()", ex.getMessage()); assertEquals("channelPool.pool.size()", 0, channelPool.pool.size()); } }