### Question:
RunInstancesOptions extends BaseEC2RequestOptions { public RunInstancesOptions withKeyName(String keyName) { formParameters.put("KeyName", checkNotNull(keyName, "keyName")); return this; }  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 testWithKeyName() { RunInstancesOptions options = new RunInstancesOptions(); options.withKeyName("test"); assertEquals(options.buildFormParameters().get("KeyName"), ImmutableList.of("test")); }
@Test public void testWithKeyNameStatic() { RunInstancesOptions options = withKeyName("test"); assertEquals(options.buildFormParameters().get("KeyName"), ImmutableList.of("test")); }
@Test(expectedExceptions = NullPointerException.class) public void testWithKeyNameNPE() { withKeyName(null); }