public void testResetPasswordForNonexistentDroplet() throws Exception {
MockWebServer server = mockWebServer();
server.enqueue(new MockResponse().setResponseCode(404));
DigitalOceanApi api = api(server.getUrl("/"));
DropletApi dropletApi = api.getDropletApi();
try {
try {
dropletApi.resetPassword(1);
fail("Reset password for droplet should fail on 404");
} catch (ResourceNotFoundException ex) {
// Expected exception
}
assertRequestHasCommonFields(server.takeRequest(), "/droplets/1/password_reset");
} finally {
api.close();
server.shutdown();
}
}