TenantsRestApi extends ApiBase implements TenantsApi { @Override public Tenant getTenant(String tenantId) throws IOException { String path = String.format("%s/%s", getBasePath(), tenantId); HttpResponse httpResponse = this.restClient.perform(RestClient.Method.GET, path, null); this.restClient.checkResponse(httpResponse, HttpStatus.SC_OK); return this.restClient.parseHttpResponse( httpResponse, new TypeReference<Tenant>() { } ); } TenantsRestApi(RestClient restClient); @Override String getBasePath(); @Override Task create(String name); @Override void createAsync(final String name, final FutureCallback<Task> responseCallback); @Override ResourceList<Tenant> listAll(); @Override void listAllAsync(final FutureCallback<ResourceList<Tenant>> responseCallback); @Override ResourceList<Tenant> listByName(String name); @Override Tenant getTenant(String tenantId); @Override void listByNameAsync(final String name, final FutureCallback<ResourceList<Tenant>> responseCallback); @Override Task delete(String id); @Override void deleteAsync(final String id, final FutureCallback<Task> responseCallback); @Override Task createResourceTicket(String tenantId, ResourceTicketCreateSpec resourceTicketCreateSpec); @Override void createResourceTicketAsync(String tenantId, ResourceTicketCreateSpec resourceTicketCreateSpec,
                                        final FutureCallback<Task> responseCallback); @Override ResourceList<ResourceTicket> getResourceTickets(String tenantId); @Override void getResourceTicketsAsync(final String tenantId, final FutureCallback<ResourceList<ResourceTicket>>
      responseCallback); @Override Task createProject(String tenantId, ProjectCreateSpec projectCreateSpec); @Override void createProjectAsync(String tenantId, ProjectCreateSpec projectCreateSpec,
                                 final FutureCallback<Task> responseCallback); @Override ResourceList<Project> getProjects(String tenantId); @Override void getProjectsAsync(final String tenantId, final FutureCallback<ResourceList<Project>>
      responseCallback);  }
@Test public void testGetTenant() throws IOException { Tenant tenant = new Tenant(); tenant.setId("tenantId-test"); tenant.setName("tenant1"); ObjectMapper mapper = new ObjectMapper(); String serializedResponse = mapper.writeValueAsString(tenant); setupMocks(serializedResponse, HttpStatus.SC_OK); TenantsApi tenantsApi = new TenantsRestApi(restClient); Tenant response = tenantsApi.getTenant("tenant1"); assertEquals(response, tenant); }