@Test public void testGetAggregator() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(200); Mockito.when(response.readEntity(Aggregator.class)).thenReturn(new Aggregator()); Aggregator aggregator = aa.getAggregator("A0r0"); Assert.assertNotNull(aggregator); }
public Aggregator getAggregator(String aggregatorId) throws DoesNotExistException { WebTarget target = client.target(restUrl + "/" + AggregatorOptionListContainer.AGGREGATORS + "/" + aggregatorId); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getAggregator(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } Aggregator aggregator = response.readEntity(Aggregator.class); LOGGER.info("getAggregator(..) success!"); return aggregator; }
AggregatorsAccessor { public Aggregator getAggregator(String aggregatorId) throws DoesNotExistException { WebTarget target = client.target(restUrl + "/" + AggregatorOptionListContainer.AGGREGATORS + "/" + aggregatorId); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getAggregator(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } Aggregator aggregator = response.readEntity(Aggregator.class); LOGGER.info("getAggregator(..) success!"); return aggregator; } }
AggregatorsAccessor { public Aggregator getAggregator(String aggregatorId) throws DoesNotExistException { WebTarget target = client.target(restUrl + "/" + AggregatorOptionListContainer.AGGREGATORS + "/" + aggregatorId); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getAggregator(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } Aggregator aggregator = response.readEntity(Aggregator.class); LOGGER.info("getAggregator(..) success!"); return aggregator; } AggregatorsAccessor(URL restUrl, String username, String password);   AggregatorsAccessor(URL restUrl, String username, String password, Client client); }
AggregatorsAccessor { public Aggregator getAggregator(String aggregatorId) throws DoesNotExistException { WebTarget target = client.target(restUrl + "/" + AggregatorOptionListContainer.AGGREGATORS + "/" + aggregatorId); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getAggregator(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } Aggregator aggregator = response.readEntity(Aggregator.class); LOGGER.info("getAggregator(..) success!"); return aggregator; } AggregatorsAccessor(URL restUrl, String username, String password);   AggregatorsAccessor(URL restUrl, String username, String password, Client client); Aggregator getAggregator(String aggregatorId); void deleteAggregator(String aggregatorId); List<Aggregator> getAggregatorList(int offset, int number); void createAggregator(String id, String name, String nameCode, String homepage); void updateAggregator(String id, String newId, String name, String nameCode,
      String homepage); URL getRestUrl(); void setRestUrl(URL restUrl); }
AggregatorsAccessor { public Aggregator getAggregator(String aggregatorId) throws DoesNotExistException { WebTarget target = client.target(restUrl + "/" + AggregatorOptionListContainer.AGGREGATORS + "/" + aggregatorId); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getAggregator(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } Aggregator aggregator = response.readEntity(Aggregator.class); LOGGER.info("getAggregator(..) success!"); return aggregator; } AggregatorsAccessor(URL restUrl, String username, String password);   AggregatorsAccessor(URL restUrl, String username, String password, Client client); Aggregator getAggregator(String aggregatorId); void deleteAggregator(String aggregatorId); List<Aggregator> getAggregatorList(int offset, int number); void createAggregator(String id, String name, String nameCode, String homepage); void updateAggregator(String id, String newId, String name, String nameCode,
      String homepage); URL getRestUrl(); void setRestUrl(URL restUrl);  }