### Question:
DatasetsAccessor { public int getDatasetRecordCount(String id) throws DoesNotExistException, InternalServerErrorException { WebTarget target = client.target(restUrl + "/" + DatasetOptionListContainer.DATASETS + "/" + id + "/" + DatasetOptionListContainer.COUNT); Response response = target.request(MediaType.APPLICATION_JSON).get(); switch (response.getStatus()) { case 404: Result errorMessage = response.readEntity(Result.class); LOGGER.warn("getDatasetRecordCount(..) failure! : " + errorMessage.getResult()); throw new DoesNotExistException(errorMessage.getResult()); case 500: errorMessage = response.readEntity(Result.class); LOGGER.warn("getDatasetRecordCount(..) failure! : " + errorMessage.getResult()); throw new InternalServerErrorException(errorMessage.getResult()); } LOGGER.info("getDatasetRecordCount(..) success!"); Result result = response.readEntity(Result.class); return Integer.parseInt(result.getResult()); } 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 testGetDatasetRecordCount() throws DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(200); Mockito.when(response.readEntity(Result.class)).thenReturn(new Result("10")); int datasetRecordCount = da.getDatasetRecordCount("ds0"); Assert.assertEquals(10, datasetRecordCount); }
@Test(expected = DoesNotExistException.class) public void testGetDatasetRecordCountDoesNotExist() throws InternalServerErrorException, DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(404); Mockito.when(response.readEntity(Result.class)).thenReturn(new Result("Does not exist!")); da.getDatasetRecordCount("ds0"); }
@Test(expected = InternalServerErrorException.class) public void testGetDatasetRecordCountInternalServerError() throws InternalServerErrorException, DoesNotExistException { Mockito.when(response.getStatus()).thenReturn(500); Mockito.when(response.readEntity(Result.class)) .thenReturn(new Result("Internal Server Error!")); da.getDatasetRecordCount("ds0"); }