@Test public void testGetStatistics() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(200); Mockito.when(response.readEntity(String.class)).thenReturn(new String("Success!!S")); String statistics = sa.getStatistics(); Assert.assertNotNull(statistics); }
public String getStatistics() { WebTarget target = client.target(restUrl + "/" + StatisticsOptionListContainer.STATISTICS); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 500) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getStatistics(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } Result result = response.readEntity(Result.class); LOGGER.info("getStatistics(..) success!"); return result.getResult(); }
StatisticsAccessor { public String getStatistics() { WebTarget target = client.target(restUrl + "/" + StatisticsOptionListContainer.STATISTICS); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 500) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getStatistics(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } Result result = response.readEntity(Result.class); LOGGER.info("getStatistics(..) success!"); return result.getResult(); } }
StatisticsAccessor { public String getStatistics() { WebTarget target = client.target(restUrl + "/" + StatisticsOptionListContainer.STATISTICS); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 500) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getStatistics(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } Result result = response.readEntity(Result.class); LOGGER.info("getStatistics(..) success!"); return result.getResult(); } StatisticsAccessor(URL restUrl, String username, String password);   StatisticsAccessor(URL restUrl, String username, String password, Client client); }
StatisticsAccessor { public String getStatistics() { WebTarget target = client.target(restUrl + "/" + StatisticsOptionListContainer.STATISTICS); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 500) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getStatistics(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } Result result = response.readEntity(Result.class); LOGGER.info("getStatistics(..) success!"); return result.getResult(); } StatisticsAccessor(URL restUrl, String username, String password);   StatisticsAccessor(URL restUrl, String username, String password, Client client); String getStatistics(); }
StatisticsAccessor { public String getStatistics() { WebTarget target = client.target(restUrl + "/" + StatisticsOptionListContainer.STATISTICS); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 500) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getStatistics(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } Result result = response.readEntity(Result.class); LOGGER.info("getStatistics(..) success!"); return result.getResult(); } StatisticsAccessor(URL restUrl, String username, String password);   StatisticsAccessor(URL restUrl, String username, String password, Client client); String getStatistics();  }