### Question:
SubnetListerService { public List<CloudSubnet> listSubnets(DetailedEnvironmentResponse environmentResponse, CloudPlatform cloudPlatform) { EnvironmentNetworkResponse environmentNetworkResponse = environmentResponse.getNetwork(); if (environmentNetworkResponse == null || environmentNetworkResponse.getSubnetMetas() == null) { throw new RedbeamsException("Environment does not contain metadata for subnets"); } switch (cloudPlatform) { case AWS: case GCP: case MOCK: return new ArrayList<>(environmentNetworkResponse.getCbSubnets().values()); case AZURE: String subscriptionId = getAzureSubscriptionId(environmentResponse.getCrn()); return new ArrayList<>(environmentNetworkResponse.getSubnetMetas().values().stream() .map(meta -> expandAzureResourceId(meta, environmentResponse, subscriptionId)) .collect(Collectors.toList())); default: throw new RedbeamsException(String.format("Support for cloud platform %s not yet added", cloudPlatform.name())); } }  List<CloudSubnet> listSubnets(DetailedEnvironmentResponse environmentResponse, CloudPlatform cloudPlatform);  }### Answer:
@Test public void testListSubnetsAws() { when(environmentNetworkResponse.getSubnetMetas()).thenReturn(subnets); when(environmentNetworkResponse.getCbSubnets()).thenReturn(subnets); credential = new Credential(CREDENTIAL_CRN, CREDENTIAL_NAME, CREDENTIAL_ATTRIBUTES); when(credentialService.getCredentialByEnvCrn(ENVIRONMENT_CRN)).thenReturn(credential); List<CloudSubnet> subnets = underTest.listSubnets(detailedEnvironmentResponse, CloudPlatform.AWS); assertEquals(2, subnets.size()); assertTrue(subnets.contains(subnet1)); assertTrue(subnets.contains(subnet2)); }