DisksRestApi extends ApiBase implements DisksApi { @Override public Task delete(String diskId) throws IOException { String path = getBasePath() + "/" + diskId; HttpResponse response = this.restClient.perform(RestClient.Method.DELETE, path, null); this.restClient.checkResponse(response, HttpStatus.SC_CREATED); return parseTaskFromHttpResponse(response); } DisksRestApi(RestClient restClient); @Override String getBasePath(); @Override PersistentDisk getDisk(String diskId); @Override void getDiskAsync(final String diskId, final FutureCallback<PersistentDisk> responseCallback); @Override ResourceList<Task> getTasksForDisk(String diskId); @Override void getTasksForDiskAsync(final String diskId, final FutureCallback<ResourceList<Task>> responseCallback); @Override Task delete(String diskId); @Override void deleteAsync(final String diskId, final FutureCallback<Task> responseCallback);  }
@Test public void testDelete() throws IOException { Task responseTask = new Task(); responseTask.setId("12345"); responseTask.setState("QUEUED"); responseTask.setQueuedTime(Date.from(Instant.now())); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(responseTask); setupMocks(serializedTask, HttpStatus.SC_CREATED); DisksApi disksApi = new DisksRestApi(restClient); Task task = disksApi.delete("foo"); assertEquals(task, responseTask); }