@Test public void successfulRemoveServersIfAllHostReturned() throws FreeIpaClientException { Set<String> hosts = Set.of("host1", "host2"); IpaServer ipaServer1 = new IpaServer(); ipaServer1.setCn("host1"); IpaServer ipaServer2 = new IpaServer(); ipaServer2.setCn("host2"); when(freeIpaClient.findAllServers()).thenReturn(Set.of(ipaServer1, ipaServer2)); Pair<Set<String>, Map<String, String>> result = underTest.removeServers(freeIpaClient, hosts); assertTrue(result.getSecond().isEmpty()); assertEquals(2, result.getFirst().size()); assertTrue(result.getFirst().contains(ipaServer1.getCn())); assertTrue(result.getFirst().contains(ipaServer2.getCn())); verify(freeIpaClient).deleteServer(eq("host1")); verify(freeIpaClient).deleteServer(eq("host2")); }
public Pair<Set<String>, Map<String, String>> removeServers(FreeIpaClient client, Set<String> hosts) throws FreeIpaClientException { return removeHosts(client, hosts, true); }
HostDeletionService { public Pair<Set<String>, Map<String, String>> removeServers(FreeIpaClient client, Set<String> hosts) throws FreeIpaClientException { return removeHosts(client, hosts, true); } }
HostDeletionService { public Pair<Set<String>, Map<String, String>> removeServers(FreeIpaClient client, Set<String> hosts) throws FreeIpaClientException { return removeHosts(client, hosts, true); }  }
HostDeletionService { public Pair<Set<String>, Map<String, String>> removeServers(FreeIpaClient client, Set<String> hosts) throws FreeIpaClientException { return removeHosts(client, hosts, true); }  Pair<Set<String>, Map<String, String>> removeHosts(FreeIpaClient client, Set<String> hosts); Pair<Set<String>, Map<String, String>> removeServers(FreeIpaClient client, Set<String> hosts); void deleteHostsWithDeleteException(FreeIpaClient client, Set<String> hosts); }
HostDeletionService { public Pair<Set<String>, Map<String, String>> removeServers(FreeIpaClient client, Set<String> hosts) throws FreeIpaClientException { return removeHosts(client, hosts, true); }  Pair<Set<String>, Map<String, String>> removeHosts(FreeIpaClient client, Set<String> hosts); Pair<Set<String>, Map<String, String>> removeServers(FreeIpaClient client, Set<String> hosts); void deleteHostsWithDeleteException(FreeIpaClient client, Set<String> hosts);  }