### Question:
ProvidersAccessor { public DataProvider getProvider(String providerId) throws DoesNotExistException { WebTarget target = client.target(restUrl + "/" + ProviderOptionListContainer.PROVIDERS + "/" + providerId); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getProvider(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } DataProvider provider = response.readEntity(DataProvider.class); LOGGER.info("getProvider(..) success!"); return provider; } 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 testGetProvider() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(200); Mockito.when(response.readEntity(DataProvider.class)).thenReturn(new DataProvider()); DataProvider dataProvider = pa.getProvider("Pr0"); Assert.assertNotNull(dataProvider); }
@Test(expected = DoesNotExistException.class) public void testGetProviderDoesNotExist() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(404); Mockito.when(response.readEntity(Result.class)).thenReturn(new Result("Does not exist!")); pa.getProvider("Pr0"); }