MongoDbFeatureExecutor extends AbstractDbFeatureExecutor<Document, MongoDatabase> { @Override protected List<Document> loadDataSets(final List<String> paths) { final List<Document> dataSets = new ArrayList<>(); try { for (final String path : paths) { final File file = new File(toUri(path)); final DataSetLoader<Document> loader = DataSetFormat.inferFromFile(file).select(new DataSetLoaderProvider()); dataSets.add(loader.load(file)); } } catch (final IOException | URISyntaxException e) { throw new JpaUnitException("Could not load initial data sets", e); } return dataSets; } MongoDbFeatureExecutor(final FeatureResolver featureResolver);   }
@Test public void testLoadDataSetsUsingAvailableFilePaths() { final List<Document> dataSetList = featureExecutor.loadDataSets(Arrays.asList("test-data.json", "test-data.json")); assertNotNull(dataSetList); assertThat(dataSetList.size(), equalTo(2)); final Document doc1 = dataSetList.get(0); assertNotNull(doc1); assertThat(doc1.entrySet().size(), equalTo(2)); final Document doc2 = dataSetList.get(1); assertNotNull(doc2); assertThat(doc2.entrySet().size(), equalTo(2)); assertThat(doc1, equalTo(doc2)); }
@Test(expected = JpaUnitException.class) public void testLoadDataSetsUsingNotAvailableFilePaths() { featureExecutor.loadDataSets(Arrays.asList("test-data1.json")); }