### Question:
ZookeeperNodeManager implements InitializingBean { public Map<String, Set<String>> getWorkerGroupNodes(){ return Collections.unmodifiableMap(workerGroupNodes); }  @Override void afterPropertiesSet(); Set<String> getMasterNodes(); Map<String, Set<String>> getWorkerGroupNodes(); Set<String> getWorkerGroupNodes(String workerGroup); void close();  }### Answer:
@Test public void testGetWorkerGroupNodes(){ workerRegistry.registry(); try { Thread.sleep(2000); } catch (InterruptedException ignore) { } Map<String, Set<String>> workerGroupNodes = zookeeperNodeManager.getWorkerGroupNodes(); Assert.assertEquals(1, workerGroupNodes.size()); Assert.assertEquals("default".trim(), workerGroupNodes.keySet().iterator().next()); workerRegistry.unRegistry(); }
@Test public void testGetWorkerGroupNodesWithParam(){ workerRegistry.registry(); try { Thread.sleep(3000); } catch (InterruptedException ignore) { } Map<String, Set<String>> workerGroupNodes = zookeeperNodeManager.getWorkerGroupNodes(); Set<String> workerNodes = zookeeperNodeManager.getWorkerGroupNodes("default"); Assert.assertTrue(CollectionUtils.isNotEmpty(workerNodes)); Assert.assertEquals(1, workerNodes.size()); Assert.assertEquals(NetUtils.getHost() + ":" + workerConfig.getListenPort(), workerNodes.iterator().next()); workerRegistry.unRegistry(); }