### Question:
MappingsAccessor { public MetadataTransformation getMapping(String id) throws DoesNotExistException { WebTarget target = client.target(restUrl + "/" + MappingOptionListContainer.MAPPINGS + "/" + id); Response response = target.request(MediaType.APPLICATION_JSON).get(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getMapping(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } MetadataTransformation metadataTransformation = response.readEntity(MetadataTransformation.class); LOGGER.info("getMapping(..) success!"); return metadataTransformation; } MappingsAccessor(URL restUrl, String username, String password);   MappingsAccessor(URL restUrl, String username, String password, Client client); MetadataTransformation getMapping(String id); void deleteMapping(String id); void createMapping(MetadataTransformation metadataTransformation, File file); void updateMapping(String id, MetadataTransformation metadataTransformation, File file);  }### Answer:
@Test public void testGetMapping() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(200); Mockito.when(response.readEntity(MetadataTransformation.class)).thenReturn( new MetadataTransformation()); MetadataTransformation mapping = ma.getMapping("map0"); Assert.assertNotNull(mapping); }
@Test(expected = DoesNotExistException.class) public void testGetMappingDoesNotExist() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(404); Mockito.when(response.readEntity(Result.class)).thenReturn(new Result("Does not exist!")); ma.getMapping("map0"); }