ReporterOutputCSV implements ReporterOutput { @Override public <T> void print(Collection<T> result) { String header = getHeader(); String[][] body = setBody(result); printCsvFile(header, body); }  @Override void setResultType(Class type); @Override void setFilePath(Path filePath); ReporterOutputCSV setDelimiter(String delimiter); @Override void print(Collection<T> result);  }
@Test public void testPrint() throws IOException { Path csvFilePath = temporaryFolder.newFile("csvFile.csv").toPath(); final String delimiter = ";"; final ReporterOutput csvReporter = ReporterOutputFactory.getReporterOutput("csv"); csvReporter.setFilePath(csvFilePath); csvReporter.setResultType(SW360SparseRelease.class); final SW360SparseRelease sparseRelease = SW360TestUtils.mkSW3SparseRelease("test"); csvReporter.print(Collections.singleton(sparseRelease)); assertThat(csvFilePath).exists(); final CSVParser csvParser = SW360TestUtils.getCsvParser(csvFilePath.toFile(), ';'); final List<CSVRecord> records = csvParser.getRecords(); assertThat(records).hasSize(1); assertThat(records.get(0).size()).isEqualTo(ReporterUtils.sparseReleaseCsvPrintHeader(delimiter).split(delimiter).length); }