PatientTumorLocationFile { @NotNull public static List<PatientTumorLocation> readRecordsTSV(@NotNull String filePath) throws IOException { List<String> lines = Files.readAllLines(new File(filePath).toPath()); List<PatientTumorLocation> patientTumorLocations = Lists.newArrayList(); for (String line : lines.subList(1, lines.size())) { String[] parts = line.split(TAB_DELIMITER); String primaryTumorLocation = parts.length > 1 ? parts[1] : Strings.EMPTY; String cancerSubtype = parts.length > 2 ? parts[2] : Strings.EMPTY; patientTumorLocations.add(ImmutablePatientTumorLocation.builder() .patientIdentifier(parts[0]) .primaryTumorLocation(primaryTumorLocation) .cancerSubtype(cancerSubtype) .build()); } return patientTumorLocations; } private  PatientTumorLocationFile(); @NotNull static List<PatientTumorLocation> readRecordsTSV(@NotNull String filePath); static void writeRecordsCSV(@NotNull String outputPath, @NotNull List<PatientTumorLocation> patientTumorLocations); static void writeRecordsTSV(@NotNull String outputPath, @NotNull List<PatientTumorLocation> patientTumorLocations);  }
@Test public void canReadInputTSV() throws IOException { List<PatientTumorLocation> patientTumorLocations = PatientTumorLocationFile.readRecordsTSV(TEST_TSV); assertEquals(3, patientTumorLocations.size()); PatientTumorLocation patient1 = patientTumorLocations.get(0); assertEquals(PATIENT1.patientIdentifier(), patient1.patientIdentifier()); assertEquals(PATIENT1.primaryTumorLocation(), patient1.primaryTumorLocation()); assertEquals(PATIENT1.cancerSubtype(), patient1.cancerSubtype()); PatientTumorLocation patient2 = patientTumorLocations.get(1); assertEquals(PATIENT2.patientIdentifier(), patient2.patientIdentifier()); assertEquals(PATIENT2.primaryTumorLocation(), patient2.primaryTumorLocation()); assertEquals(PATIENT2.cancerSubtype(), patient2.cancerSubtype()); PatientTumorLocation patient3 = patientTumorLocations.get(2); assertEquals(PATIENT3.patientIdentifier(), patient3.patientIdentifier()); assertEquals(PATIENT3.primaryTumorLocation(), patient3.primaryTumorLocation()); assertEquals(PATIENT3.cancerSubtype(), patient3.cancerSubtype()); }