ReportingDb { @NotNull @VisibleForTesting static List<ReportingEntry> read(@NotNull String reportingDbTsv) throws IOException { List<String> linesReportDates = LineReader.build().readLines(new File(reportingDbTsv).toPath(), line -> line.length() > 0); List<ReportingEntry> reportingEntryList = Lists.newArrayList(); for (String line : linesReportDates.subList(1, linesReportDates.size())) { String[] values = line.split(DELIMITER); reportingEntryList.add(ImmutableReportingEntry.builder() .tumorBarcode(values[0]) .sampleId(values[1]) .cohort(values[2]) .reportDate(values[3]) .reportType(values[4]) .purity(values[5]) .hasReliableQuality(values[6]) .hasReliablePurity(values[7]) .build()); } return reportingEntryList; } private  ReportingDb(); static void addAnalysedReportToReportingDb(@NotNull String reportingDbTsv, @NotNull AnalysedPatientReport report); static void addQCFailReportToReportingDb(@NotNull String reportingDbTsv, @NotNull QCFailReport report);  }
@Test public void canReadReportingDbTsv() throws IOException { List<ReportingEntry> reportingEntries = ReportingDb.read(REPORTING_DB_TSV); assertEquals(2, reportingEntries.size()); ReportingEntry reportingEntry1 = reportingEntries.get(0); assertEquals("ABCD", reportingEntry1.tumorBarcode()); assertEquals("sampleId1", reportingEntry1.sampleId()); assertEquals("A", reportingEntry1.cohort()); assertEquals("22-Oct-2019", reportingEntry1.reportDate()); assertEquals("dna_analysis_report", reportingEntry1.reportType()); assertEquals("0.70", reportingEntry1.purity()); assertEquals("true", reportingEntry1.hasReliableQuality()); assertEquals("false", reportingEntry1.hasReliablePurity()); ReportingEntry reportingEntry2 = reportingEntries.get(1); assertEquals("EFGH", reportingEntry2.tumorBarcode()); assertEquals("sampleId2", reportingEntry2.sampleId()); assertEquals("B", reportingEntry2.cohort()); assertEquals("23-Oct-2019", reportingEntry2.reportDate()); assertEquals("insufficient_dna", reportingEntry2.reportType()); assertEquals("N/A", reportingEntry2.purity()); assertEquals("N/A", reportingEntry2.hasReliableQuality()); assertEquals("N/A", reportingEntry2.hasReliablePurity()); }