DisksRestApi extends ApiBase implements DisksApi { @Override public PersistentDisk getDisk(String diskId) throws IOException { String path = String.format("%s/%s", getBasePath(), diskId); HttpResponse httpResponse = this.restClient.perform(RestClient.Method.GET, path, null); this.restClient.checkResponse(httpResponse, HttpStatus.SC_OK); return this.restClient.parseHttpResponse( httpResponse, new TypeReference<PersistentDisk>() { } ); } 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 testGetDisk() throws IOException { PersistentDisk persistentDisk = new PersistentDisk(); persistentDisk.setId("persistentDisk"); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(persistentDisk); setupMocks(serializedTask, HttpStatus.SC_OK); DisksApi disksApi = new DisksRestApi(restClient); PersistentDisk response = disksApi.getDisk("disk1"); assertEquals(response, persistentDisk); }