KeeperServiceImpl implements KeeperService { @Override public boolean isKeeper(HostPort hostPort) { return metaCache.getAllKeepers().contains(hostPort); }  @Override boolean isKeeper(HostPort hostPort);  }
@Test public void testIsKeeper() throws Exception { when(metaCache.getAllKeepers()).thenReturn(Collections.singleton(new HostPort("127.0.0.1", 6379))); HostPort hostPort = new HostPort("127.0.0.1", 6379); Assert.assertTrue(keeperService.isKeeper(hostPort)); Assert.assertFalse(keeperService.isKeeper(new HostPort("128.0.0.1", 6380))); }