### Question:
UploadsInfo { public DataSet getDataSet(String datasetId) { notEmpty(datasetId, "datasetId"); final DataSet dataSet = datasets.get(datasetId); if (dataSet != null) { return dataSet; } else { throw new DatasetNotFoundException(datasetId); } } UploadsInfo(@JsonProperty("sets") Collection<DataSet> datasets); DataSet getDataSet(String datasetId); @Override String toString(); static final String URI; }### Answer:
@Test public void shouldDeserialize() throws Exception { final UploadsInfo uploadsInfo = readObjectFromResource("/dataset/uploads/data-sets.json", UploadsInfo.class); assertThat(uploadsInfo, notNullValue()); final UploadsInfo.DataSet dataset = uploadsInfo.getDataSet("dataset.campaign"); assertThat(dataset, notNullValue()); assertThat(dataset.getDatasetId(), is("dataset.campaign")); assertThat(dataset.getUploadsUri(), is("/gdc/md/PROJECT_ID/data/uploads/814")); assertThat(dataset.getLastUploadUri(), is("/gdc/md/PROJECT_ID/data/upload/1076")); }
@Test(expectedExceptions = DatasetNotFoundException.class) public void getDatasetUploadInfoFails() throws Exception { new UploadsInfo(Collections.emptyList()).getDataSet("dataset.non_existing_one"); }