@Test public void testDeleteProvider() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(200); pa.deleteProvider("Pr0"); }
public void deleteProvider(String providerId) throws DoesNotExistException, InternalServerErrorException { WebTarget target = client.target(restUrl + "/" + ProviderOptionListContainer.PROVIDERS + "/" + providerId); Response response = target.request(MediaType.APPLICATION_JSON).delete(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteProvider(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } else if (response.getStatus() == 500) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteProvider(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } LOGGER.info("deleteProvider(..) success!"); }
ProvidersAccessor { public void deleteProvider(String providerId) throws DoesNotExistException, InternalServerErrorException { WebTarget target = client.target(restUrl + "/" + ProviderOptionListContainer.PROVIDERS + "/" + providerId); Response response = target.request(MediaType.APPLICATION_JSON).delete(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteProvider(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } else if (response.getStatus() == 500) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteProvider(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } LOGGER.info("deleteProvider(..) success!"); } }
ProvidersAccessor { public void deleteProvider(String providerId) throws DoesNotExistException, InternalServerErrorException { WebTarget target = client.target(restUrl + "/" + ProviderOptionListContainer.PROVIDERS + "/" + providerId); Response response = target.request(MediaType.APPLICATION_JSON).delete(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteProvider(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } else if (response.getStatus() == 500) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteProvider(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } LOGGER.info("deleteProvider(..) success!"); } ProvidersAccessor(URL restUrl, String username, String password);   ProvidersAccessor(URL restUrl, String username, String password, Client client); }
ProvidersAccessor { public void deleteProvider(String providerId) throws DoesNotExistException, InternalServerErrorException { WebTarget target = client.target(restUrl + "/" + ProviderOptionListContainer.PROVIDERS + "/" + providerId); Response response = target.request(MediaType.APPLICATION_JSON).delete(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteProvider(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } else if (response.getStatus() == 500) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteProvider(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } LOGGER.info("deleteProvider(..) success!"); } ProvidersAccessor(URL restUrl, String username, String password);   ProvidersAccessor(URL restUrl, String username, String password, Client client); DataProvider getProvider(String providerId); void deleteProvider(String providerId); List<DataProvider> getProviderList(String aggregatorId, int offset, int number); String createProvider(String aggregatorId, String id, String name, String country, String countryCode, 
      String description, String nameCode, String homepage, ProviderType providerType, String email); void updateProvider(String id, String newId, String newAggregatorId, String name, String country, String countryCode,
      String description, String nameCode, String homepage, ProviderType providerType, String email); }
ProvidersAccessor { public void deleteProvider(String providerId) throws DoesNotExistException, InternalServerErrorException { WebTarget target = client.target(restUrl + "/" + ProviderOptionListContainer.PROVIDERS + "/" + providerId); Response response = target.request(MediaType.APPLICATION_JSON).delete(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteProvider(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } else if (response.getStatus() == 500) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteProvider(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } LOGGER.info("deleteProvider(..) success!"); } ProvidersAccessor(URL restUrl, String username, String password);   ProvidersAccessor(URL restUrl, String username, String password, Client client); DataProvider getProvider(String providerId); void deleteProvider(String providerId); List<DataProvider> getProviderList(String aggregatorId, int offset, int number); String createProvider(String aggregatorId, String id, String name, String country, String countryCode, 
      String description, String nameCode, String homepage, ProviderType providerType, String email); void updateProvider(String id, String newId, String newAggregatorId, String name, String country, String countryCode,
      String description, String nameCode, String homepage, ProviderType providerType, String email);  }