HTMLReportGenerator extends AbstractGenerator { @Override public Map<String, IAttachable> produce(Collection<Artifact> artifacts){ Path copiedReportStyle = context.getToolConfiguration() .getAntennaTargetDirectory() .resolve(LICENSE_REPORT_STYLE_FILE); Set<ArtifactForHTMLReport> artifactsForHTMLReport = extractRelevantArtifactInformation(artifacts); writeReportToFile(artifactsForHTMLReport, licenseReport.toFile()); try { FileUtils.copyURLToFile(licenseReportStyle, copiedReportStyle.toFile()); } catch (IOException e) { throw new ExecutionException("Cannot write HTML style file", e); } return Collections.singletonMap(IDENTIFIER, new Attachable(TYPE, CLASSIFIER, licenseReport.toFile())); } HTMLReportGenerator(); @Override Map<String, IAttachable> produce(Collection<Artifact> artifacts); @Override void configure(Map<String, String> configMap);  }
@Test public void testThatArtifactsAreIncluded() throws Exception { htmlReportGenerator.produce(artifacts); byte[] encoded = Files.readAllBytes(temporaryFolder.getRoot().toPath().resolve("3rdparty-licenses.html")); final String contentOfFile = new String(encoded, charset); assertThat(contentOfFile).contains(LICENSEID1); assertThat(contentOfFile).contains(LICENSETEXT1); assertThat(contentOfFile).contains(ARTIFACTID1); assertThat(contentOfFile).contains(ARTIFACTVERSION1); assertThat(contentOfFile).contains(LICENSEID2); assertThat(contentOfFile).contains(LICENSETEXT2); assertThat(contentOfFile).contains(LICENSECOMMONNAME); assertThat(contentOfFile).contains(LICENSEID3); assertThat(contentOfFile).contains(LICENSETEXT3); assertThat(contentOfFile).contains(ARTIFACTID2); assertThat(contentOfFile).contains(ARTIFACTVERSION2); assertThat(contentOfFile).contains(ARTIFACTID3); assertThat(contentOfFile).contains(ARTIFACTVERSION3); assertThat(contentOfFile).contains(ARTIFACTID4); assertThat(contentOfFile).contains(ARTIFACTVERSION4); assertThat(contentOfFile).contains(COPYRIGHTLIST.get(0)); assertThat(contentOfFile).contains(COPYRIGHTLIST.get(1)); assertThat(contentOfFile).contains(ARTIFACTFILENAME1); assertThat(contentOfFile).contains(ARTIFACTFILENAME2); assertThat(temporaryFolder.getRoot().toPath().resolve("styles.css")).exists(); }