### Question:
NovaTemplateOptions extends TemplateOptions implements Cloneable { @Override public NovaTemplateOptions installPrivateKey(String privateKey) { return NovaTemplateOptions.class.cast(super.installPrivateKey(privateKey)); }  @Override NovaTemplateOptions clone(); @Override void copyTo(TemplateOptions to); @Override boolean equals(Object o); @Override int hashCode(); @Override ToStringHelper string(); NovaTemplateOptions autoAssignFloatingIp(boolean enable); NovaTemplateOptions floatingIpPoolNames(String... floatingIpPoolNames); NovaTemplateOptions floatingIpPoolNames(Iterable<String> floatingIpPoolNames); NovaTemplateOptions generateKeyPair(boolean enable); NovaTemplateOptions keyPairName(String keyPairName); boolean shouldAutoAssignFloatingIp(); NovaTemplateOptions availabilityZone(String availabilityZone); NovaTemplateOptions blockDeviceMappings(BlockDeviceMapping... blockDeviceMappings); NovaTemplateOptions blockDeviceMappings(Iterable<BlockDeviceMapping> blockDeviceMappings); Optional<Set<String>> getFloatingIpPoolNames(); String getKeyPairName(); boolean shouldGenerateKeyPair(); byte[] getUserData(); String getDiskConfig(); boolean getConfigDrive(); Set<Network> getNovaNetworks(); String getAvailabilityZone(); Set<BlockDeviceMapping> getBlockDeviceMappings(); @Override NovaTemplateOptions blockOnPort(int port, int seconds); @Override NovaTemplateOptions inboundPorts(int... ports); @Override NovaTemplateOptions authorizePublicKey(String publicKey); @Override NovaTemplateOptions installPrivateKey(String privateKey); @Override NovaTemplateOptions blockUntilRunning(boolean blockUntilRunning); @Override NovaTemplateOptions dontAuthorizePublicKey(); @Override NovaTemplateOptions nameTask(String name); @Override NovaTemplateOptions runAsRoot(boolean runAsRoot); @Override NovaTemplateOptions runScript(Statement script); @Override NovaTemplateOptions overrideLoginCredentials(LoginCredentials overridingCredentials); @Override NovaTemplateOptions overrideLoginPassword(String password); @Override NovaTemplateOptions overrideLoginPrivateKey(String privateKey); @Override NovaTemplateOptions overrideLoginUser(String loginUser); @Override NovaTemplateOptions overrideAuthenticateSudo(boolean authenticateSudo); @Override NovaTemplateOptions userMetadata(Map<String, String> userMetadata); @Override NovaTemplateOptions userMetadata(String key, String value); @Override NovaTemplateOptions nodeNames(Iterable<String> nodeNames); @Override NovaTemplateOptions networks(Iterable<String> networks); @Override NovaTemplateOptions networks(String... networks); NovaTemplateOptions userData(byte[] userData); NovaTemplateOptions diskConfig(String diskConfig); NovaTemplateOptions configDrive(boolean configDrive); NovaTemplateOptions novaNetworks(Set<Network> novaNetworks);  }### Answer:
@Test(expectedExceptions = IllegalArgumentException.class) public void testinstallPrivateKeyBadFormat() { NovaTemplateOptions options = new NovaTemplateOptions(); options.installPrivateKey("whompy"); }
@Test public void testinstallPrivateKey() throws IOException { NovaTemplateOptions options = new NovaTemplateOptions(); options.installPrivateKey("-----BEGIN RSA PRIVATE KEY-----"); assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----"); }
@Test public void testinstallPrivateKeyStatic() throws IOException { NovaTemplateOptions options = installPrivateKey("-----BEGIN RSA PRIVATE KEY-----"); assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----"); }
@Test(expectedExceptions = NullPointerException.class) public void testinstallPrivateKeyNPE() { installPrivateKey(null); }