### Question:
DatasetService extends AbstractService { public Collection<Link> listDatasetLinks(final Project project) { notNull(project, "project"); notNull(project.getId(), "project.id"); try { final DatasetLinks result = restTemplate.getForObject(DatasetLinks.URI, DatasetLinks.class, project.getId()); if (result == null) { throw new GoodDataException("Empty response from API call"); } else if (result.getLinks() == null) { return emptyList(); } return result.getLinks(); } catch (GoodDataException | RestClientException e) { throw new GoodDataException("Unable to list datasets for project " + project.getId(), e); } } 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(expectedExceptions = IllegalArgumentException.class) public void testListDatasetLinksWithNullProject() { service.listDatasetLinks(null); }
@Test(expectedExceptions = GoodDataException.class) public void testListDatasetLinksWithNullResponse() { when(restTemplate.getForObject(DatasetLinks.URI, Link.class, PROJECT_ID)).thenReturn(null); service.listDatasetLinks(project); }
@Test(expectedExceptions = GoodDataException.class) public void testListDatasetLinksWithRestClientError() { when(restTemplate.getForObject(DatasetLinks.URI, Link.class, PROJECT_ID)).thenThrow(new RestClientException("")); service.listDatasetLinks(project); }