### Question:
RoundRobinHostManager extends CommonHostManager { @Override public Host select(Collection<Host> nodes) { return selector.select(nodes); } RoundRobinHostManager(); @Override Host select(Collection<Host> nodes);  }### Answer:
@Test public void testSelectWithEmptyResult() { Mockito.when(zookeeperNodeManager.getWorkerGroupNodes("default")).thenReturn(null); ExecutionContext context = ExecutionContextTestUtils.getExecutionContext(10000); Host emptyHost = roundRobinHostManager.select(context); Assert.assertTrue(StringUtils.isEmpty(emptyHost.getAddress())); }
@Test public void testSelectWithResult() { Mockito.when(zookeeperNodeManager.getWorkerGroupNodes("default")).thenReturn(Sets.newHashSet("192.168.1.1:22:100")); ExecutionContext context = ExecutionContextTestUtils.getExecutionContext(10000); Host host = roundRobinHostManager.select(context); Assert.assertTrue(StringUtils.isNotEmpty(host.getAddress())); Assert.assertTrue(host.getAddress().equalsIgnoreCase("192.168.1.1:22")); }