CluecumberReportPlugin extends PropertyCollector { public void execute() throws CluecumberPluginException { logger.initialize(getLog(), logLevel); if (skip) { logger.info("Cluecumber report generation was skipped using the <skip> property.", DEFAULT); return; } logger.logInfoSeparator(DEFAULT); logger.info(String.format(" Cluecumber Report Maven Plugin, version %s", getClass().getPackage() .getImplementationVersion()), DEFAULT); logger.logInfoSeparator(DEFAULT, COMPACT); super.execute(); fileSystemManager.createDirectory(propertyManager.getGeneratedHtmlReportDirectory() + "/attachments"); AllScenariosPageCollection allScenariosPageCollection = new AllScenariosPageCollection(propertyManager.getCustomPageTitle()); List<Path> jsonFilePaths = fileSystemManager.getJsonFilePaths(propertyManager.getSourceJsonReportDirectory()); for (Path jsonFilePath : jsonFilePaths) { String jsonString = fileIO.readContentFromFile(jsonFilePath.toString()); try { Report[] reports = jsonPojoConverter.convertJsonToReportPojos(jsonString); allScenariosPageCollection.addReports(reports); } catch (CluecumberPluginException e) { logger.warn("Could not parse JSON in file '" + jsonFilePath.toString() + "': " + e.getMessage()); } } elementIndexPreProcessor.addScenarioIndices(allScenariosPageCollection.getReports()); reportGenerator.generateReport(allScenariosPageCollection); logger.info( "=> Cluecumber Report: " + propertyManager.getGeneratedHtmlReportDirectory() + "/" + PluginSettings.START_PAGE_PATH + PluginSettings.HTML_FILE_EXTENSION, DEFAULT, COMPACT, CluecumberLogger.CluecumberLogLevel.MINIMAL ); } @Inject  CluecumberReportPlugin(
            final CluecumberLogger logger,
            final PropertyManager propertyManager,
            final FileSystemManager fileSystemManager,
            final FileIO fileIO,
            final JsonPojoConverter jsonPojoConverter,
            final ElementIndexPreProcessor elementIndexPreProcessor,
            final ReportGenerator reportGenerator
    ); void execute();  }
@Test public void executeTest() throws CluecumberPluginException { cluecumberReportPlugin.execute(); }
@Test public void noErrorOnUnparsableJsonTest() throws CluecumberPluginException { when(fileIO.readContentFromFile(any())).thenReturn("json"); when(jsonPojoConverter.convertJsonToReportPojos("json")).thenThrow(new CluecumberPluginException("failure")); cluecumberReportPlugin.execute(); }