ScenarioVisitor implements PageVisitor { @Override public void visit(final AllScenariosPageCollection allScenariosPageCollection) throws CluecumberPluginException { fileIO.writeContentToFile( allScenariosPageRenderer.getRenderedContent(allScenariosPageCollection, templateEngine.getTemplate(ALL_SCENARIOS)), propertyManager.getGeneratedHtmlReportDirectory() + "/" + PluginSettings.PAGES_DIRECTORY + "/" + PluginSettings.SCENARIO_SUMMARY_PAGE_PATH + PluginSettings.HTML_FILE_EXTENSION); fileIO.writeContentToFile( allScenariosPageRenderer.getRenderedContent( allScenariosPageCollection, templateEngine.getTemplate(SCENARIO_SEQUENCE) ), propertyManager.getGeneratedHtmlReportDirectory() + "/" + PluginSettings.PAGES_DIRECTORY + "/" + PluginSettings.SCENARIO_SEQUENCE_PAGE_PATH + PluginSettings.HTML_FILE_EXTENSION); ScenarioDetailsPageCollection scenarioDetailsPageCollection; for (Report report : allScenariosPageCollection.getReports()) { for (Element element : report.getElements()) { scenarioDetailsPageCollection = new ScenarioDetailsPageCollection(element, propertyManager.getCustomPageTitle()); fileIO.writeContentToFile( scenarioDetailsPageRenderer.getRenderedContent( scenarioDetailsPageCollection, templateEngine.getTemplate(SCENARIO_DETAILS) ), propertyManager.getGeneratedHtmlReportDirectory() + "/" + PluginSettings.PAGES_DIRECTORY + PluginSettings.SCENARIO_DETAIL_PAGE_FRAGMENT + element.getScenarioIndex() + PluginSettings.HTML_FILE_EXTENSION); } } } @Inject  ScenarioVisitor(
            final FileIO fileIO,
            final TemplateEngine templateEngine,
            final PropertyManager propertyManager,
            final AllScenariosPageRenderer allScenariosPageRenderer,
            final ScenarioDetailsPageRenderer scenarioDetailsPageRenderer
    ); @Override void visit(final AllScenariosPageCollection allScenariosPageCollection);  }
@Test public void visitTest() throws CluecumberPluginException { when(allScenariosPageRenderer.getRenderedContent(any(), any())).thenReturn("MyRenderedScenarios"); when(scenarioDetailsPageRenderer.getRenderedContent(any(), any())).thenReturn("MyRenderedScenarioDetails"); scenarioVisitor.visit(getAllScenarioPageCollection()); verify(fileIo, times(1)) .writeContentToFile("MyRenderedScenarios", "dummyPath/pages/scenario-summary.html"); verify(fileIo, times(1)) .writeContentToFile("MyRenderedScenarios", "dummyPath/pages/scenario-sequence.html"); verify(fileIo, times(1)) .writeContentToFile("MyRenderedScenarioDetails", "dummyPath/pages/scenario-detail/scenario_0.html"); }