@Override
    public Collection<String> getServices() {
        check("get services from zookeeper");
        try {
            return serviceDiscovery.queryForNames();
        } catch (Exception exception) {
            LOGGER.log(Level.WARNING, "Can not query services from registry center!", exception);
        }
        return Collections.emptyList();
    }
@Test
    public void getServices() throws Exception {
        final List<String> serviceNames = Arrays.asList("test1", "test2");
        Mockito.when(serviceDiscovery.queryForNames()).thenReturn(serviceNames);
        Assert.assertEquals(zkDiscoveryClient.getServices(), serviceNames);

        // The simulation throws an exception
        Mockito.when(serviceDiscovery.queryForNames()).thenThrow(new IllegalStateException("wrong"));
        Assert.assertEquals(Collections.emptyList(), zkDiscoveryClient.getServices());
    }