### Question:
DatasetsAccessor { public void deleteDataset(String datasetId) throws DoesNotExistException { WebTarget target = client.target(restUrl + "/" + DatasetOptionListContainer.DATASETS + "/" + datasetId); Response response = target.request(MediaType.APPLICATION_JSON).delete(); if (response.getStatus() == 404) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteDataset(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); } else if (response.getStatus() == 500) { Result errorMessage = response.readEntity(Result.class); LOGGER.warn("deleteDataset(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } LOGGER.info("deleteDataset(..) success!"); } DatasetsAccessor(URL restUrl, String username, String password);   DatasetsAccessor(URL restUrl, String username, String password, Client client); DataSourceContainer getDataset(String datasetId); void deleteDataset(String datasetId); List<DataSourceContainer> getDatasetList(String providerId, int offset, int number); String createDatasetOai(String providerId, String id, String name, String nameCode,
      boolean isSample, String schema, String description, String namespace, String metadataFormat,
      String marcFormat, String oaiUrl, String oaiSet, String exportDir,
      RecordIdPolicy recordIdPolicy, Map<String, MetadataTransformation> metadataTransformations); String createDatasetFile(String providerId, String id, String name, String nameCode,
      boolean isSample, String schema, String description, String namespace, String metadataFormat,
      String marcFormat, String exportDir, RecordIdPolicy recordIdPolicy,
      FileExtractStrategy extractStrategy, FileRetrieveStrategy retrieveStrategy,
      CharacterEncoding characterEncoding, Iso2709Variant isoVariant, String sourceDirectory,
      String recordXPath, Map<String, MetadataTransformation> metadataTransformations); void updateDatasetOai(String id, String newId, String name, String nameCode,
      boolean isSample, String schema, String description, String namespace, String metadataFormat,
      String marcFormat, String oaiUrl, String oaiSet, String exportDir,
      RecordIdPolicy recordIdPolicy, Map<String, MetadataTransformation> metadataTransformations); void updateDatasetFile(String id, String newId, String name, String nameCode,
      boolean isSample, String schema, String description, String namespace, String metadataFormat,
      String marcFormat, String exportDir, RecordIdPolicy recordIdPolicy,
      FileExtractStrategy extractStrategy, FileRetrieveStrategy retrieveStrategy,
      CharacterEncoding characterEncoding, Iso2709Variant isoVariant, String sourceDirectory,
      String recordXPath, Map<String, MetadataTransformation> metadataTransformations); void copyDataset(String id, String newId); String getDatasetLastIngestionDate(String id); int getDatasetRecordCount(String id); void exportDataset(String id, String format);  }### Answer:
@Test public void testDeleteDataset() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(200); da.deleteDataset("d0r0"); }
@Test(expected = DoesNotExistException.class) public void testDeleteDatasetDoesNotExist() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(404); Mockito.when(response.readEntity(Result.class)).thenReturn(new Result("Does not exist!")); da.deleteDataset("d0r0"); }
@Test(expected = InternalServerErrorException.class) public void testDeleteDatasetInternalServerError() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(500); Mockito.when(response.readEntity(Result.class)) .thenReturn(new Result("Internal Server Error!")); da.deleteDataset("d0r0"); }