### Question:
EnvironmentResourceService { public BaseNetwork createAndSetNetwork(Environment environment, NetworkDto networkDto, String accountId, Map<String, CloudSubnet> subnetMetas) { BaseNetwork network = networkService.saveNetwork(environment, networkDto, accountId, subnetMetas); if (network != null) { environment.setNetwork(network); } return network; } EnvironmentResourceService(CredentialService credentialService, NetworkService networkService, CloudPlatformConnectors cloudPlatformConnectors,
            CredentialToCloudCredentialConverter credentialToCloudCredentialConverter, Clock clock, ProxyConfigService proxyConfigService); Credential getCredentialFromRequest(CredentialAwareEnvRequest request, String accountId); Optional<ProxyConfig> getProxyConfig(String proxyConfigName, String accountId); boolean createAndUpdateSshKey(Environment environment); Optional<PublicKeyConnector> getPublicKeyConnector(String cloudPlatform); BaseNetwork createAndSetNetwork(Environment environment, NetworkDto networkDto, String accountId, Map<String, CloudSubnet> subnetMetas); void deletePublicKey(Environment environment); void deletePublicKey(Environment environment, String publicKeyId); boolean isPublicKeyIdExists(Environment environment, String publicKeyId);  }### Answer:
@Test void createAndSetNetwork() { Environment environment = new Environment(); NetworkDto networkDto = null; BaseNetwork network = new AwsNetwork(); when(networkService.saveNetwork(eq(environment), eq(networkDto), eq(ACCOUNT_ID), any())).thenReturn(network); assertEquals(network, environmentResourceServiceUnderTest.createAndSetNetwork(environment, networkDto, ACCOUNT_ID, Map.of())); }