### Question:
RunInstancesOptions extends BaseEC2RequestOptions { public RunInstancesOptions withSecurityGroup(String securityGroup) { return withSecurityGroups(securityGroup); }  RunInstancesOptions withKeyName(String keyName); RunInstancesOptions withSecurityGroups(String... securityGroups); RunInstancesOptions withSecurityGroups(Iterable<String> securityGroups); RunInstancesOptions withSecurityGroup(String securityGroup); RunInstancesOptions withUserData(byte[] unencodedData); RunInstancesOptions asType(String type); RunInstancesOptions withKernelId(String kernelId); RunInstancesOptions withRamdisk(String ramDiskId); RunInstancesOptions withBlockDeviceMappings(Set<? extends BlockDeviceMapping> mappings); RunInstancesOptions withClientToken(String clientToken); static final RunInstancesOptions NONE; }### Answer:
@Test public void testWithSecurityGroup() { RunInstancesOptions options = new RunInstancesOptions(); options.withSecurityGroup("test"); assertEquals(options.buildFormParameters().get("SecurityGroup.1"), ImmutableList.of("test")); }
@Test public void testWithSecurityGroupStatic() { RunInstancesOptions options = withSecurityGroup("test"); assertEquals(options.buildFormParameters().get("SecurityGroup.1"), ImmutableList.of("test")); }
@Test(expectedExceptions = NullPointerException.class) public void testWithSecurityGroupNPE() { withSecurityGroup(null); }