### Question:
MappingsAccessor { public void deleteMapping(String id) throws DoesNotExistException, InternalServerErrorException { WebTarget target = client.target(restUrl + "/" + MappingOptionListContainer.MAPPINGS + "/" + id); Response response = target.request(MediaType.APPLICATION_JSON).delete(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteMapping(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } else if (response.getStatus() == 500) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteMapping(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } LOGGER.info("deleteMapping(..) success!"); } 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 testDeleteMapping() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(200); ma.deleteMapping("map0"); }
@Test(expected = DoesNotExistException.class) public void testDeleteMappingDoesNotExist() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(404); Mockito.when(response.readEntity(Result.class)).thenReturn(new Result("Does not exist!")); ma.deleteMapping("map0"); }
@Test(expected = InternalServerErrorException.class) public void testDeleteMappingInternalServerError() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(500); Mockito.when(response.readEntity(Result.class)) .thenReturn(new Result("Internal Server Error!")); ma.deleteMapping("map0"); }