ServerService { public boolean isEnableServer(final String ip) { String serverStatus = jobNodeStorage.getJobNodeData(serverNode.getServerNode(ip)); while (Strings.isNullOrEmpty(serverStatus)) { BlockUtils.waitingShortTime(); serverStatus = jobNodeStorage.getJobNodeData(serverNode.getServerNode(ip)); } return !ServerStatus.DISABLED.name().equals(serverStatus); } ServerService(final CoordinatorRegistryCenter regCenter, final String jobName); void persistOnline(final boolean enabled); boolean hasAvailableServers(); boolean isAvailableServer(final String ip); boolean isEnableServer(final String ip);  }
@Test public void assertIsNotEnableServer() { when(jobNodeStorage.getJobNodeData("servers/127.0.0.1")).thenReturn("", ServerStatus.DISABLED.name()); assertFalse(serverService.isEnableServer("127.0.0.1")); }
@Test public void assertIsEnableServer() { when(jobNodeStorage.getJobNodeData("servers/127.0.0.1")).thenReturn("", ServerStatus.ENABLED.name()); assertTrue(serverService.isEnableServer("127.0.0.1")); }