### Question:
JcrDataSetProvider extends BaseJcrProvider<DataSet, DataSet.ID> implements DataSetProvider { @Override public Optional<DataSet> find(com.thinkbiganalytics.metadata.api.catalog.DataSet.ID id) { return Optional.ofNullable(findById(id)); }  static long generateHashCode(String format, Collection<String> paths, Map<String, String> options); @Override DataSet.ID resolveId(Serializable fid); @Override DataSetBuilder build(ID dataSourceId); @Override Optional<DataSet> find(com.thinkbiganalytics.metadata.api.catalog.DataSet.ID id); @Override List<DataSet> findByDataSource(DataSource.ID dsId, DataSource.ID... otherIds); @Override List<DataSet> findByDataSource(Collection<ID> dsIds); @Override DataSet findByDataSourceAndTitle(ID dataSourceId, String title); @Override Class<? extends JcrEntity<?>> getJcrEntityClass(); @Override String getNodeType(Class<? extends JcrObject> jcrEntityType);  }### Answer:
@Test public void testCreate() { metadata.commit(() -> { DataSet dset = null; for (int srcIdx = 0; srcIdx < 2; srcIdx++) { for (int dsIdx = 1; dsIdx <= COUNT + 1; dsIdx++) { dset = createDataSet(this.dSrcIds.get(srcIdx), srcIdx * 10 + dsIdx); } this.dSetIds.add(dset.getId()); } }, MetadataAccess.SERVICE); metadata.read(() -> { Optional<DataSet> dset0 = this.dataSetProvider.find(this.dSetIds.get(0)); assertThat(dset0).isNotNull().isPresent(); assertThat(dset0.get()).extracting("title", "description").contains(dataSetTuple(COUNT + 1).toArray()); assertThat(dset0.get().getDataSource()).isNotNull().extracting("id").contains(this.dSrcIds.get(0)); Optional<DataSet> dset1 = this.dataSetProvider.find(this.dSetIds.get(1)); assertThat(dset1).isNotNull().isPresent(); assertThat(dset1.get()).extracting("title", "description").contains(dataSetTuple(10 + COUNT + 1).toArray()); assertThat(dset1.get().getDataSource()).isNotNull().extracting("id").contains(this.dSrcIds.get(1)); }, MetadataAccess.SERVICE); }
@Test public void testDelete() { metadata.commit(() -> { this.dataSetProvider.deleteById(this.dSetIds.get(0)); this.dataSetProvider.deleteById(this.dSetIds.get(1)); }, MetadataAccess.SERVICE); metadata.read(() -> { Optional<DataSet> ds0 = this.dataSetProvider.find(this.dSetIds.get(0)); Optional<DataSet> ds1 = this.dataSetProvider.find(this.dSetIds.get(1)); assertThat(ds0).isNotNull().isNotPresent(); assertThat(ds1).isNotNull().isNotPresent(); }, MetadataAccess.SERVICE); }
@Test(dependsOnMethods="testDelete") public void testDataSourceHasDataSets() { metadata.read(() -> { Optional<DataSource> dsrc = this.dataSourceProvider.find(dSrcIds.get(0)); assertThat(dsrc).isNotNull().isPresent(); List<? extends DataSet> dsList = dsrc.get().getDataSets(); assertThat(dsList).hasSize(COUNT); }, MetadataAccess.SERVICE); }