### Question:
DatasetService extends AbstractService { public Upload getLastUploadForDataset(Project project, String datasetId) { final UploadsInfo.DataSet dataSet = getDataSetInfo(project, datasetId); if (isEmpty(dataSet.getLastUploadUri())) { return null; } try { return restTemplate.getForObject(dataSet.getLastUploadUri(), Upload.class); } catch (RestClientException e) { throw new GoodDataException("Unable to get '" + dataSet.getLastUploadUri() + "'."); } } DatasetService(final RestTemplate restTemplate, final DataStoreService dataStoreService,
                          final GoodDataSettings settings); DatasetManifest getDatasetManifest(Project project, String datasetId); FutureResult<Void> loadDataset(final Project project, final DatasetManifest manifest,
                                          final InputStream dataset); FutureResult<Void> loadDataset(Project project, String datasetId, InputStream dataset); FutureResult<Void> loadDatasets(final Project project, DatasetManifest... datasets); FutureResult<Void> loadDatasets(final Project project, final Collection<DatasetManifest> datasets); Collection<Link> listDatasetLinks(final Project project); FutureResult<Void> optimizeSliHash(final Project project); FutureResult<Void> updateProjectData(final Project project, final String maqlDml); Collection<Upload> listUploadsForDataset(Project project, String datasetId); Upload getLastUploadForDataset(Project project, String datasetId); UploadStatistics getUploadStatistics(Project project); static final UriTemplate UPLOADS_INFO_TEMPLATE; }### Answer:
@Test public void testGetLastUploadForDatasetMissingUri() throws Exception { mockDataSetInfo(DATASET_UPLOADS_URI, null); assertThat(service.getLastUploadForDataset(project, DATASET_ID), nullValue()); }
@Test(expectedExceptions = GoodDataException.class) public void testGetLastUploadForDatasetRestClientError() throws Exception { final String lastUploadUri = "last/upload/uri"; mockDataSetInfo(DATASET_UPLOADS_URI, lastUploadUri); when(restTemplate.getForObject(lastUploadUri, Upload.class)).thenThrow(new RestClientException("")); service.getLastUploadForDataset(project, DATASET_ID); }