TagVisitor implements PageVisitor { @Override public void visit(final AllScenariosPageCollection allScenariosPageCollection) throws CluecumberPluginException { AllTagsPageCollection allTagsPageCollection = new AllTagsPageCollection( allScenariosPageCollection.getReports(), propertyManager.getCustomPageTitle() ); fileIO.writeContentToFile( allTagsPageRenderer.getRenderedContent( allTagsPageCollection, templateEngine.getTemplate(ALL_TAGS) ), propertyManager.getGeneratedHtmlReportDirectory() + "/" + PluginSettings.PAGES_DIRECTORY + "/" + PluginSettings.TAG_SUMMARY_PAGE_PATH + PluginSettings.HTML_FILE_EXTENSION); for (Tag tag : allTagsPageCollection.getTags()) { fileIO.writeContentToFile( allScenariosPageRenderer.getRenderedContentByTagFilter( allScenariosPageCollection, templateEngine.getTemplate(ALL_SCENARIOS), tag), propertyManager.getGeneratedHtmlReportDirectory() + "/" + PluginSettings.PAGES_DIRECTORY + PluginSettings.TAG_SCENARIO_PAGE_FRAGMENT + tag.getUrlFriendlyName() + PluginSettings.HTML_FILE_EXTENSION); } } @Inject  TagVisitor(
            final FileIO fileIO,
            final TemplateEngine templateEngine,
            final PropertyManager propertyManager,
            final AllTagsPageRenderer allTagsPageRenderer,
            final AllScenariosPageRenderer allScenariosPageRenderer
    ); @Override void visit(final AllScenariosPageCollection allScenariosPageCollection);  }
@Test public void visitTest() throws CluecumberPluginException { when(allTagsPageRenderer.getRenderedContent(any(), any())).thenReturn("MyRenderedTags"); when(allScenariosPageRenderer.getRenderedContentByTagFilter(any(), any(), any())).thenReturn("MyRenderedScenarios"); tagVisitor.visit(getAllScenarioPageCollection()); verify(fileIo, times(1)) .writeContentToFile("MyRenderedTags", "dummyPath/pages/tag-summary.html"); verify(fileIo, times(1)) .writeContentToFile("MyRenderedScenarios", "dummyPath/pages/tag-scenarios/tag_myTag.html"); }