### Question:
MongoDbFeatureExecutor extends AbstractDbFeatureExecutor<Document, MongoDatabase> { @Override protected DbFeature<MongoDatabase> createApplyCustomScriptFeature(final List<String> scriptPaths) { return (final MongoDatabase connection) -> { try { for (final String scriptPath : scriptPaths) { executeScript(loadScript(scriptPath), connection); } } catch (IOException | URISyntaxException e) { throw new DbFeatureException("Could not apply custom scripts feature", e); } }; } MongoDbFeatureExecutor(final FeatureResolver featureResolver);   }### Answer:
@Test public void testApplyCustomScriptFeatureExecutionUsingAvailableFilePaths() throws DbFeatureException { final DbFeature<MongoDatabase> feature = featureExecutor .createApplyCustomScriptFeature(Arrays.asList("test-data.json", "test-data.json")); assertThat(feature, notNullValue()); feature.execute(connection); verify(connection, times(2)).runCommand(any(Bson.class)); }
@Test public void testApplyCustomScriptFeatureExecutionUsingEmpyFile() throws DbFeatureException, IOException { final File tmpFile = tmpFolder.newFile(); final DbFeature<MongoDatabase> feature = featureExecutor.createApplyCustomScriptFeature(Arrays.asList(tmpFile.getPath())); assertThat(feature, notNullValue()); feature.execute(connection); verify(connection, never()).runCommand(any(Bson.class)); }
@Test(expected = DbFeatureException.class) public void testApplyCustomScriptFeatureExecutionUsingNotAvailableFilePaths() throws DbFeatureException { final DbFeature<MongoDatabase> feature = featureExecutor.createApplyCustomScriptFeature(Arrays.asList("test-data1.json")); assertThat(feature, notNullValue()); feature.execute(connection); }