SqlDbFeatureExecutor extends AbstractDbFeatureExecutor<IDataSet, IDatabaseConnection> { @Override protected DbFeature<IDatabaseConnection> createCleanupFeature(final CleanupStrategy cleanupStrategy, final List<IDataSet> initialDataSets) { return (final IDatabaseConnection connection) -> { final CleanupStrategyExecutor<IDatabaseConnection, IDataSet> executor = cleanupStrategy .provide(providerFactory.createCleanupStrategyProvider()); executor.execute(connection, initialDataSets); }; } SqlDbFeatureExecutor(final FeatureResolver featureResolver);   }
@SuppressWarnings("unchecked") @Test public void testCleanupFeatureExecution() throws DbFeatureException { when(cleanupStrategy.provide(any(CleanupStrategy.StrategyProvider.class))).thenReturn(cleanupStrategyExecutor); final List<IDataSet> initialDataSets = Arrays.asList(mock(IDataSet.class)); final DbFeature<IDatabaseConnection> feature = featureExecutor.createCleanupFeature(cleanupStrategy, initialDataSets); assertThat(feature, notNullValue()); feature.execute(connection); verify(cleanupStrategyExecutor).execute(eq(connection), eq(initialDataSets)); }