FeatureVisitor implements PageVisitor { @Override public void visit(final AllScenariosPageCollection allScenariosPageCollection) throws CluecumberPluginException { AllFeaturesPageCollection allFeaturesPageCollection = new AllFeaturesPageCollection(allScenariosPageCollection.getReports(), propertyManager.getCustomPageTitle()); fileIO.writeContentToFile( allFeaturesPageRenderer.getRenderedContent(allFeaturesPageCollection, templateEngine.getTemplate(ALL_FEATURES)), propertyManager.getGeneratedHtmlReportDirectory() + "/" + PluginSettings.PAGES_DIRECTORY + "/" + PluginSettings.FEATURE_SUMMARY_PAGE_PATH + PluginSettings.HTML_FILE_EXTENSION); for (Feature feature : allFeaturesPageCollection.getFeatures()) { fileIO.writeContentToFile( allScenariosPageRenderer.getRenderedContentByFeatureFilter( allScenariosPageCollection, templateEngine.getTemplate(ALL_SCENARIOS), feature ), propertyManager.getGeneratedHtmlReportDirectory() + "/" + PluginSettings.PAGES_DIRECTORY + PluginSettings.FEATURE_SCENARIOS_PAGE_FRAGMENT + feature.getIndex() + PluginSettings.HTML_FILE_EXTENSION); } } @Inject  FeatureVisitor(
            final FileIO fileIO,
            final TemplateEngine templateEngine,
            final PropertyManager propertyManager,
            final AllFeaturesPageRenderer allFeaturesPageRenderer,
            final AllScenariosPageRenderer allScenariosPageRenderer
    ); @Override void visit(final AllScenariosPageCollection allScenariosPageCollection);  }
@Test public void visitTest() throws CluecumberPluginException { when(allFeaturesPageRenderer.getRenderedContent(any(), any())).thenReturn("MyRenderedFeatures"); when(allScenariosPageRenderer.getRenderedContentByFeatureFilter(any(), any(), any())).thenReturn("MyRenderedScenarios"); featureVisitor.visit(getAllScenarioPageCollection()); verify(fileIo, times(1)) .writeContentToFile("MyRenderedFeatures", "dummyPath/pages/feature-summary.html"); verify(fileIo, times(1)) .writeContentToFile("MyRenderedScenarios", "dummyPath/pages/feature-scenarios/feature_12.html"); }