ImagesRestApi extends ApiBase implements ImagesApi { @Override public Task delete(String id) throws IOException { String path = String.format("%s/%s", getBasePath(), id); HttpResponse response = this.restClient.perform(RestClient.Method.DELETE, path, null); this.restClient.checkResponse(response, HttpStatus.SC_CREATED); return parseTaskFromHttpResponse(response); } ImagesRestApi(RestClient restClient); @Override String getBasePath(); @Override Task uploadImage(String inputFileName); @Override Task uploadImage(String inputFileName, String replicationType); @Override Task uploadImage(FileBody fileBody, String replicationType); @Override Image getImage(String imageId); @Override void getImageAsync(final String imageId, final FutureCallback<Image> responseCallback); @Override ResourceList<Image> getImages(); @Override void getImagesAsync(final FutureCallback<ResourceList<Image>> responseCallback); @Override Task delete(String id); @Override void deleteAsync(final String id, final FutureCallback<Task> responseCallback);  }
@Test public void testDeleteImage() 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); ImagesApi imagesApi = new ImagesRestApi(this.restClient); Task task = imagesApi.delete("foo"); assertEquals(task, responseTask); }