### Question:
AzureVirtualMachineTypeProvider { public Set<String> getVmTypes(AzureStackView azureStackView) { return azureStackView.getGroups().values().stream() .flatMap(Collection::stream) .map(this::getFlavour) .collect(Collectors.toSet()); }  Set<String> getVmTypes(AzureStackView azureStackView);  }### Answer:
@Test public void testGetVmTypesShouldReturnsTheAvailableVmTypes() { Map<String, List<AzureInstanceView>> instanceGroups = createInstanceGroups(); AzureStackView azureStackView = createAzureStackView(instanceGroups); Set<String> actual = underTest.getVmTypes(azureStackView); Assert.assertEquals(4, actual.size()); Assert.assertTrue(actual.contains(STANDARD_DS_V2)); Assert.assertTrue(actual.contains(STANDARD_D3_V2)); Assert.assertTrue(actual.contains(STANDARD_E16A_V3)); Assert.assertTrue(actual.contains(STANDARD_D15_V2)); }
@Test(expected = IllegalArgumentException.class) public void testGetVmTypesShouldThrowExceptionWhenAFlavourIsMissing() { Map<String, List<AzureInstanceView>> instanceGroups = createInstanceGroupsWithAMissingFlavour(); AzureStackView azureStackView = createAzureStackView(instanceGroups); underTest.getVmTypes(azureStackView); }