### Question:
EnvironmentNetworkService { public void deleteNetwork(EnvironmentDto environment) { getNetworkConnector(environment.getCloudPlatform()) .ifPresentOrElse(connector -> connector.deleteNetworkWithSubnets(createNetworkDeletionRequest(environment)), () -> LOGGER.info("No network connector for cloud platform: {}", environment.getCloudPlatform())); } EnvironmentNetworkService(
            CloudPlatformConnectors cloudPlatformConnectors,
            NetworkCreationRequestFactory networkCreationRequestFactory,
            Map<CloudPlatform, EnvironmentNetworkConverter> environmentNetworkConverterMap,
            CredentialToCloudCredentialConverter credentialToCloudCredentialConverter); BaseNetwork createCloudNetwork(EnvironmentDto environment, BaseNetwork baseNetwork); NetworkCidr getNetworkCidr(Network network, String cloudPlatform, Credential credential); void deleteNetwork(EnvironmentDto environment);  }### Answer:
@Test void testDeleteNetworkShouldDeleteTheNetwork() { CloudCredential cloudCredential = new CloudCredential("1", "asd"); EnvironmentDto environmentDto = createEnvironmentDto(null); when(cloudConnector.networkConnector()).thenReturn(networkConnector); when(credentialToCloudCredentialConverter.convert(environmentDto.getCredential())).thenReturn(cloudCredential); when(networkCreationRequestFactory.getStackName(any())).thenReturn(STACK_NAME); underTest.deleteNetwork(environmentDto); ArgumentCaptor<NetworkDeletionRequest> argumentCaptor = ArgumentCaptor.forClass(NetworkDeletionRequest.class); verify(networkConnector).deleteNetworkWithSubnets(argumentCaptor.capture()); assertEquals(STACK_NAME, argumentCaptor.getValue().getStackName()); assertEquals(cloudCredential, argumentCaptor.getValue().getCloudCredential()); assertEquals(environmentDto.getLocation().getName(), argumentCaptor.getValue().getRegion()); assertNull(argumentCaptor.getValue().getResourceGroup()); }