MongoDbFeatureExecutor extends AbstractDbFeatureExecutor<Document, MongoDatabase> { @Override protected DbFeature<MongoDatabase> createVerifyDataAfterFeature(final ExpectedDataSets expectedDataSets) { return (final MongoDatabase connection) -> { final Document expectedDataSet = mergeDataSets(loadDataSets(Arrays.asList(expectedDataSets.value()))); final DataSetComparator dataSetComparator = new DataSetComparator(expectedDataSets.excludeColumns(), expectedDataSets.strict()); final AssertionErrorCollector errorCollector = new AssertionErrorCollector(); dataSetComparator.compare(connection, expectedDataSet, errorCollector); errorCollector.report(); }; } MongoDbFeatureExecutor(final FeatureResolver featureResolver);   }
@SuppressWarnings("unchecked") @Test public void testVerifyDataAfterFeatureExecution() throws DbFeatureException { final MongoIterable<String> collectionIterable = mock(MongoIterable.class); final MongoCursor<String> iterator = mock(MongoCursor.class); when(expectedDataSets.strict()).thenReturn(Boolean.FALSE); when(expectedDataSets.value()).thenReturn(new String[] {}); when(expectedDataSets.orderBy()).thenReturn(new String[] {}); when(expectedDataSets.excludeColumns()).thenReturn(new String[] {}); when(connection.listCollectionNames()).thenReturn(collectionIterable); when(collectionIterable.iterator()).thenReturn(iterator); when(iterator.hasNext()).thenReturn(Boolean.FALSE); final DbFeature<MongoDatabase> feature = featureExecutor.createVerifyDataAfterFeature(expectedDataSets); assertThat(feature, notNullValue()); feature.execute(connection); verify(connection).listCollectionNames(); verifyNoMoreInteractions(connection); }