server.shutdown();
}
}
public void testDestroyWithOptionsNonexistentDroplet() throws Exception {
MockWebServer server = mockWebServer();
server.enqueue(new MockResponse().setResponseCode(404));
DigitalOceanApi api = api(server.getUrl("/"));
DropletApi dropletApi = api.getDropletApi();
try {
try {
dropletApi.destroy(1, true);
fail("Destroy droplet should fail on 404");
} catch (ResourceNotFoundException ex) {
// Expected exception
}
assertRequestHasParameters(server.takeRequest(), "/droplets/1/destroy",
ImmutableMultimap.of("scrub_data", "true"));
} finally {
api.close();
server.shutdown();
}
}