### Question:
CreateResourcesThenCreateNodes extends CreateNodesWithGroupEncodedIntoNameThenAddToSet { @VisibleForTesting void normalizeNetworkOptions(AzureTemplateOptions options) { if (!options.getNetworks().isEmpty() && !options.getIpOptions().isEmpty()) { throw new IllegalArgumentException("The options.networks and options.ipOptions are exclusive"); } if (!options.getNetworks().isEmpty()) { ImmutableList.Builder<IpOptions> ipOptions = ImmutableList.builder(); for (String subnetId : options.getNetworks()) { ipOptions.add(IpOptions.builder().subnet(subnetId).allocateNewPublicIp(true).build()); } options.ipOptions(ipOptions.build()); } if (!options.getIpOptions().isEmpty()) { for (IpOptions ipConfig : options.getIpOptions()) { if (ipConfig.allocateNewPublicIp() && ipConfig.publicIpId() != null) { throw new IllegalArgumentException("The allocateNewPublicIps and publicIpId are exclusive"); } String resourceGroup = extractResourceGroup(ipConfig.subnet()); String networkName = extractVirtualNetwork(ipConfig.subnet()); String subnetName = extractName(ipConfig.subnet()); Subnet subnet = api.getSubnetApi(resourceGroup, networkName).get(subnetName); checkState(subnet != null, "Configured subnet %s does not exist", ipConfig.subnet()); if (ipConfig.publicIpId() != null) { PublicIPAddress publicIp = api.getPublicIPAddressApi(extractResourceGroup(ipConfig.publicIpId())).get( extractName(ipConfig.publicIpId())); checkState(publicIp != null, "Configured public ip %s does not exist", ipConfig.publicIpId()); } } } } @Inject protected  CreateResourcesThenCreateNodes(
         CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy,
         ListNodesStrategy listNodesStrategy,
         GroupNamingConvention.Factory namingConvention,
         @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor,
         CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory,
         AzureComputeApi api, @Named(DEFAULT_VNET_ADDRESS_SPACE_PREFIX) String defaultVnetAddressPrefix,
         @Named(DEFAULT_SUBNET_ADDRESS_PREFIX) String defaultSubnetAddressPrefix,
         LoadingCache<ResourceGroupAndNameAndIngressRules, String> securityGroupMap,
         TemplateToAvailabilitySet templateToAvailabilitySet, PasswordGenerator.Config passwordGenerator,
         NetworkAvailablePredicateFactory networkAvailable); @Override Map<?, ListenableFuture<Void>> execute(String group, int count, Template template,
         Set<NodeMetadata> goodNodes, Map<NodeMetadata, Exception> badNodes,
         Multimap<NodeMetadata, CustomizationResponse> customizationResponses);  }### Answer:
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The options.networks and options.ipOptions are exclusive") public void testNormalizeNetworkOptionsWithConflictingConfig() { AzureTemplateOptions options = new AzureTemplateOptions(); options.ipOptions(IpOptions.builder().subnet(netResource("/virtualNetworks/vn/subnets/foo")).build()); options.networks(netResource("/virtualNetworks/vn/subnets/bar")); strategy(null).normalizeNetworkOptions(options); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "The allocateNewPublicIps and publicIpId are exclusive") public void testNormalizeNetworkOptionsExclusivePublicIps() { AzureTemplateOptions options = new AzureTemplateOptions(); options.ipOptions(IpOptions.builder().subnet(netResource("/virtualNetworks/vn/subnets/foo")) .allocateNewPublicIp(true).publicIpId(netResource("/publicIPAddresses/pub")).build()); strategy(null).normalizeNetworkOptions(options); }