### Question:
AWSRunInstancesOptions extends RunInstancesOptions { @SinceApiVersion("2012-06-01") public AWSRunInstancesOptions withIAMInstanceProfileArn(String arn) { formParameters.put("IamInstanceProfile.Arn", checkNotNull(arn, "arn")); return this; }  AWSRunInstancesOptions inPlacementGroup(String placementGroup); AWSRunInstancesOptions enableMonitoring(); AWSRunInstancesOptions associatePublicIpAddressAndSubnetId(String subnetId); AWSRunInstancesOptions withSubnetId(String subnetId); AWSRunInstancesOptions withSecurityGroupId(String securityGroup); AWSRunInstancesOptions withSecurityGroupIds(Iterable<String> securityGroupIds); AWSRunInstancesOptions withSecurityGroupIdsForNetworkInterface(Iterable<String> securityGroupIds); AWSRunInstancesOptions withSecurityGroupIds(String... securityGroupIds); AWSRunInstancesOptions withSecurityGroupIdsForNetworkInterface(String... securityGroupIds); @SinceApiVersion("2012-06-01") AWSRunInstancesOptions withIAMInstanceProfileArn(String arn); @SinceApiVersion("2012-06-01") AWSRunInstancesOptions withIAMInstanceProfileName(String name); AWSRunInstancesOptions withPrivateIpAddress(String address); @Override AWSRunInstancesOptions withBlockDeviceMappings(Set<? extends BlockDeviceMapping> mappings); @Override AWSRunInstancesOptions withKernelId(String kernelId); @Override AWSRunInstancesOptions withKeyName(String keyName); @Override AWSRunInstancesOptions withRamdisk(String ramDiskId); @Override AWSRunInstancesOptions withSecurityGroup(String securityGroup); @Override AWSRunInstancesOptions withSecurityGroups(Iterable<String> securityGroups); @Override AWSRunInstancesOptions withSecurityGroups(String... securityGroups); @Override AWSRunInstancesOptions withUserData(byte[] unencodedData); @Override AWSRunInstancesOptions asType(String type); synchronized LaunchSpecification.Builder getLaunchSpecificationBuilder(); static final AWSRunInstancesOptions NONE; }### Answer:
@Test public void testWithIAMInstanceProfileArn() { AWSRunInstancesOptions options = new AWSRunInstancesOptions(); options .withIAMInstanceProfileArn("arn:aws:iam::123456789012:instance-profile/application_abc/component_xyz/Webserver"); assertEquals(options.buildFormParameters().get("IamInstanceProfile.Arn"), ImmutableList.of("arn:aws:iam::123456789012:instance-profile/application_abc/component_xyz/Webserver")); }
@Test public void testWithIAMInstanceProfileArnStatic() { AWSRunInstancesOptions options = withIAMInstanceProfileArn("arn:aws:iam::123456789012:instance-profile/application_abc/component_xyz/Webserver"); assertEquals(options.buildFormParameters().get("IamInstanceProfile.Arn"), ImmutableList.of("arn:aws:iam::123456789012:instance-profile/application_abc/component_xyz/Webserver")); }
@Test(expectedExceptions = NullPointerException.class) public void testWithIAMInstanceProfileArnNPE() { withIAMInstanceProfileArn(null); }