### Question:
BaseDnsEntryService extends BasePublicEndpointManagementService { public Map<String, String> deregister(Stack stack) { return doActionOnStack(stack, null, this::doDeregister); }  Map<String, String> createOrUpdate(Stack stack); Map<String, String> deregister(Stack stack); Map<String, String> createOrUpdateCandidates(Stack stack, Map<String, String> candidateAddressesByFqdn); Map<String, String> deregister(Stack stack, Map<String, String> candidateAddressesByFqdn);  }### Answer:
@Test void testDeregister() { Stack stack = new Stack(); stack.setEnvironmentCrn(ENVIRONMENT_CRN); Cluster cluster = new Cluster(); stack.setCluster(cluster); setInstanceGroups(stack); DetailedEnvironmentResponse environmentResponse = new DetailedEnvironmentResponse(); environmentResponse.setName(ENVIRONMENT_NAME); Map<String, List<String>> componentLocation = Map.of(NIFI_NODE, List.of(FQDN_1, FQDN_2, FQDN_3)); when(environmentClientService.getByCrn(stack.getEnvironmentCrn())).thenReturn(environmentResponse); when(componentLocatorService.getComponentLocation(stack.getCluster(), nifiConfigProvider.getRoleTypes())) .thenReturn(componentLocation); when(dnsManagementService.deleteDnsEntryWithIp(USER_CRN, ACCOUNT_ID, FQDN_1, ENVIRONMENT_NAME, false, List.of(PUBLIC_IP_1))).thenReturn(true); when(dnsManagementService.deleteDnsEntryWithIp(USER_CRN, ACCOUNT_ID, FQDN_2, ENVIRONMENT_NAME, false, List.of(PUBLIC_IP_2))).thenReturn(true); when(dnsManagementService.deleteDnsEntryWithIp(USER_CRN, ACCOUNT_ID, FQDN_3, ENVIRONMENT_NAME, false, List.of(PUBLIC_IP_3))).thenReturn(true); Map<String, String> result = underTest.deregister(stack); assertEquals(3, result.size()); assertTrue(result.containsKey(FQDN_1)); assertTrue(result.containsKey(FQDN_2)); assertTrue(result.containsKey(FQDN_3)); assertEquals(PUBLIC_IP_1, result.get(FQDN_1)); assertEquals(PUBLIC_IP_2, result.get(FQDN_2)); assertEquals(PUBLIC_IP_3, result.get(FQDN_3)); }