WideEcrfFileReader { @NotNull public static List<WideBiopsyData> readBiopsies(@NotNull String pathToCsv) throws IOException { List<WideBiopsyData> wideBiopsies = Lists.newArrayList(); for (CSVRecord line : readCsvSkipHeader(pathToCsv, COMMA_DELIMITER)) { if (line.size() == BIOPSY_DATA_COUNT) { String widePatientId = WideFileInputInterpreter.toWideID(line.get(BIOPSY_DATA_PATIENT_ID)); if (!widePatientId.isEmpty()) { WideBiopsyData wideBiopsy = ImmutableWideBiopsyData.builder() .widePatientId(widePatientId) .pathologySampleId(line.get(BIOPSY_DATA_PATHOLOGY_SAMPLE_ID)) .biopsyDate(WideFileInputInterpreter.interpretDateEN(line.get(BIOPSY_DATA_DATE))) .hasReceivedSuccessfulReport(WideFileInputInterpreter.convertHasReceivedSuccessfulReport(line.get( BIOPSY_DATA_HAS_RECEIVED_SUCCESSFUL_REPORT))) .build(); wideBiopsies.add(wideBiopsy); } } else { LOGGER.warn("Could not properly parse record in WIDE biopsy csv: {}", line); } } return wideBiopsies; } private  WideEcrfFileReader(); @NotNull static List<WideFiveDays> readFiveDays(@NotNull String pathToCsv); @NotNull static List<WidePreAvlTreatmentData> readPreAvlTreatments(@NotNull String pathToCsv); @NotNull static List<WideBiopsyData> readBiopsies(@NotNull String pathToCsv); @NotNull static List<WideAvlTreatmentData> readAvlTreatments(@NotNull String pathToCsv); @NotNull static List<WideResponseData> readResponses(@NotNull String pathToCsv);  }
@Test public void canReadWideBiopsies() throws IOException { List<WideBiopsyData> biopsies = WideEcrfFileReader.readBiopsies(WIDE_TEST_DIR + File.separator + "wide_biopsies.csv"); assertEquals(2, biopsies.size()); assertEquals("WIDE01018888", biopsies.get(0).widePatientId()); assertEquals("T18-00001", biopsies.get(0).pathologySampleId()); assertEquals(LocalDate.parse("2018-01-18"), biopsies.get(0).biopsyDate()); assertNull(biopsies.get(0).hasReceivedSuccessfulReport()); assertEquals("WIDE01019999", biopsies.get(1).widePatientId()); assertEquals("T19-00001", biopsies.get(1).pathologySampleId()); assertEquals(LocalDate.parse("2019-04-18"), biopsies.get(1).biopsyDate()); assertTrue(biopsies.get(1).hasReceivedSuccessfulReport()); }