### Question:
AzureStackViewProvider { AzureStackView getAzureStack(AzureCredentialView azureCredentialView, CloudStack cloudStack, AzureClient client, AuthenticatedContext ac) { Map<String, String> customImageNamePerInstance = getCustomImageNamePerInstance(ac, cloudStack); Network network = cloudStack.getNetwork(); Map<String, Long> availableIPs = getNumberOfAvailableIPsInSubnets(client, network); return new AzureStackView(ac.getCloudContext().getName(), stackNamePrefixLength, cloudStack.getGroups(), new AzureStorageView(azureCredentialView, ac.getCloudContext(), azureStorage, azureStorage.getArmAttachedStorageOption(cloudStack.getParameters())), AzureSubnetStrategy.getAzureSubnetStrategy(FILL, azureUtils.getCustomSubnetIds(network), availableIPs), customImageNamePerInstance); }    }### Answer:
@Test public void testGetAzureStackShouldReturnsANewAzureStackView() { CloudCredential cloudCredential = createCloudCredential(); AzureCredentialView azureCredentialView = new AzureCredentialView(cloudCredential); AuthenticatedContext ac = new AuthenticatedContext(createCloudContext(), cloudCredential); Network network = mock(Network.class); AzureImage image = new AzureImage("id", "name", true); when(azureStorage.getCustomImage(any(), any(), any(), any())).thenReturn(image); List<Group> groups = createScaledGroups(); when(cloudStack.getGroups()).thenReturn(groups); when(cloudStack.getParameters()).thenReturn(Collections.emptyMap()); when(cloudStack.getNetwork()).thenReturn(network); when(network.getStringParameter("resourceGroupName")).thenReturn(RESOURCE_GROUP); when(network.getStringParameter("networkId")).thenReturn(NETWORK_ID); when(azureUtils.getCustomSubnetIds(network)).thenReturn(Collections.emptyList()); AzureStackView actual = underTest.getAzureStack(azureCredentialView, cloudStack, client, ac); assertEquals("i1", actual.getGroups().get(InstanceGroupType.CORE.name()).get(0).getInstanceId()); assertEquals(GROUP_NAME, actual.getInstanceGroups().get(0).getName()); }