### Question:
ProvidersAccessor { public List<DataProvider> getProviderList(String aggregatorId, int offset, int number) throws InvalidArgumentsException, DoesNotExistException { WebTarget target = client.target(restUrl + "/" + ProviderOptionListContainer.PROVIDERS) .queryParam(ProviderOptionListContainer.AGGREGATORID, aggregatorId) .queryParam(ProviderOptionListContainer.OFFSET, offset) .queryParam(ProviderOptionListContainer.NUMBER, number); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 400) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getProviderList(..) failure! : " + errorMessage.getResult()); throw new InvalidArgumentsException(errorMessage.getResult()); } else if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getProviderList(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } List<DataProvider> subList = response.readEntity(new GenericType<List<DataProvider>>() {}); LOGGER.info("getProviderList(..) success!"); return subList; } 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);  }### Answer:
@Test public void testGetProviderList() throws InvalidArgumentsException, DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(200); pa.getProviderList("A0r0", 0, 1); Mockito.when(response.readEntity(new GenericType<List<DataProvider>>() {})).thenReturn( new ArrayList<DataProvider>()); }
@Test(expected = InvalidArgumentsException.class) public void testGetProviderListInvalidArguments() throws InvalidArgumentsException, DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(400); Mockito.when(response.readEntity(Result.class)).thenReturn(new Result("Invalid argument!")); pa.getProviderList("A0r0", 0, 1); }
@Test(expected = DoesNotExistException.class) public void testGetProviderListDoesNotExist() throws InvalidArgumentsException, DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(404); Mockito.when(response.readEntity(Result.class)).thenReturn(new Result("Does not exist!")); pa.getProviderList("A0r0", 0, 1); }