public void testCreateDropletWithOptions() throws Exception {
MockWebServer server = mockWebServer();
server.enqueue(new MockResponse().setBody(payloadFromResource("/droplet-creation.json")));
DigitalOceanApi api = api(server.getUrl("/"));
DropletApi dropletApi = api.getDropletApi();
try {
CreateDropletOptions options = CreateDropletOptions.builder().addSshKeyId(5).addSshKeyId(4)
.privateNetworking(true).backupsEnabled(false).build();
DropletCreation droplet = dropletApi.create("test", 419, 32, 1, options);
ImmutableMultimap.Builder<String, String> params = ImmutableMultimap.builder();
params.put("name", "test");
params.put("image_id", "419");
params.put("size_id", "32");
params.put("region_id", "1");
params.put("ssh_key_ids", "5,4");
params.put("private_networking", "true");
params.put("backups_enabled", "false");
assertRequestHasParameters(server.takeRequest(), "/droplets/new", params.build());
assertNotNull(droplet);
assertEquals(droplet.getName(), "test");
} finally {
api.close();
server.shutdown();
}
}