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