### Question:
KubernetesDiscoveryService implements DiscoveryService { @Override public Set<String> discoverMembers() { LOGGER.debug("CELLAR KUBERNETES: query pods with labeled with [{}={}]", kubernetesPodLabelKey, kubernetesPodLabelValue); Set<String> members = new HashSet<String>(); try { PodList podList = kubernetesClient.pods().list(); for (Pod pod : podList.getItems()) { String value = pod.getMetadata().getLabels().get(kubernetesPodLabelKey); if (value != null && !value.isEmpty() && value.equals(kubernetesPodLabelValue)) { members.add(pod.getStatus().getPodIP()); } } } catch (Exception e) { LOGGER.error("CELLAR KUBERNETES: can't get pods", e); } return members; } KubernetesDiscoveryService(); void init(); void destroy(); void update(Map<String, Object> properties); @Override Set<String> discoverMembers(); @Override void signIn(); @Override void refresh(); @Override void signOut(); String getKubernetesPodLabelKey(); void setKubernetesPodLabelKey(String kubernetesPodLabelKey); String getKubernetesPodLabelValue(); void setKubernetesPodLabelValue(String kubernetesPodLabelValue); String getKubernetesMaster(); void setKubernetesMaster(String kubernetesMaster); String getKubernetesApiVersion(); void setKubernetesApiVersion(String kubernetesApiVersion); boolean isKubernetesTrustCertificates(); void setKubernetesTrustCertificates(String kubernetesTrustCertificates); boolean isKubernetesDisableHostnameVerification(); void setKubernetesDisableHostnameVerification(String kubernetesDisableHostnameVerification); String getKubernetesCertsCaFile(); void setKubernetesCertsCaFile(String kubernetesCertsCaFile); String getKubernetesCertsCaData(); void setKubernetesCertsCaData(String kubernetesCertsCaData); String getKubernetesCertsClientFile(); void setKubernetesCertsClientFile(String kubernetesCertsClientFile); String getKubernetesCertsClientData(); void setKubernetesCertsClientData(String kubernetesCertsClientData); String getKubernetesCertsClientKeyFile(); void setKubernetesCertsClientKeyFile(String kubernetesCertsClientKeyFile); String getKubernetesCertsClientKeyData(); void setKubernetesCertsClientKeyData(String kubernetesCertsClientKeyData); String getKubernetesCertsClientKeyAlgo(); void setKubernetesCertsClientKeyAlgo(String kubernetesCertsClientKeyAlgo); String getKubernetesCertsClientKeyPassphrase(); void setKubernetesCertsClientKeyPassphrase(String kubernetesCertsClientKeyPassphrase); String getKubernetesAuthBasicUsername(); void setKubernetesAuthBasicUsername(String kubernetesAuthBasicUsername); String getKubernetesAuthBasicPassword(); void setKubernetesAuthBasicPassword(String kubernetesAuthBasicPassword); String getKubernetesOauthToken(); void setKubernetesOauthToken(String kubernetesOauthToken); int getKubernetesWatchReconnectInterval(); void setKubernetesWatchReconnectInterval(String kubernetesWatchReconnectInterval); int getKubernetesWatchReconnectLimit(); void setKubernetesWatchReconnectLimit(String kubernetesWatchReconnectLimit); String getKubernetesUserAgent(); void setKubernetesUserAgent(String kubernetesUserAgent); String getKubernetesTlsVersion(); void setKubernetesTlsVersion(String kubernetesTlsVersion); String getKubernetesTruststoreFile(); void setKubernetesTruststoreFile(String kubernetesTruststoreFile); String getKubernetesTruststorePassphrase(); void setKubernetesTruststorePassphrase(String kubernetesTruststorePassphrase); String getKubernetesKeystoreFile(); void setKubernetesKeystoreFile(String kubernetesKeystoreFile); String getKubernetesKeystorePassphrase(); void setKubernetesKeystorePassphrase(String kubernetesKeystorePassphrase);  }### Answer:
@Test public void discoverMembers() { Set<String> memberIps = service.discoverMembers(); assertEquals(1, memberIps.size()); assertEquals(EXPECTED_POD_ID, memberIps.iterator().next()); }
@Test public void discoverMembersLogException() { reset(kubernetesClient); expect(kubernetesClient.pods()).andThrow(new RuntimeException("Test exception")); replay(kubernetesClient); assertTrue(service.discoverMembers().isEmpty()); }