HospitalModelFactory { @NotNull @VisibleForTesting static Map<String, String> readFromSampleToHospitalMapping(@NotNull String sampleHospitalMappingTsv) throws IOException { Map<String, String> hospitalPerSampleMap = Maps.newHashMap(); List<String> lines = FileReader.build().readLines(new File(sampleHospitalMappingTsv).toPath()); for (String line : lines.subList(1, lines.size())) { String[] parts = line.split(FIELD_SEPARATOR); if (parts.length == FIELD_COUNT_SAMPLE_HOSPITAL_MAPPING) { hospitalPerSampleMap.put(parts[SAMPLE_MAPPING_ID_COLUMN], parts[HOSPITAL_MAPPING_COLUMN]); } else { LOGGER.warn("Could not properly parse line in sample hospital mapping tsv: '{}'", line); } } return hospitalPerSampleMap; } private  HospitalModelFactory(); @NotNull static HospitalModel fromLimsDirectory(@NotNull String limsDirectory);  }
@Test public void canReadSampleToHospitalMapping() throws IOException { Map<String, String> sampleHospitalMapping = HospitalModelFactory.readFromSampleToHospitalMapping(LIMS_DIRECTORY + File.separator + "sample_hospital_mapping.tsv"); assertEquals(2, sampleHospitalMapping.size()); assertEquals("01", sampleHospitalMapping.get("CORE18001224T")); assertEquals("02", sampleHospitalMapping.get("CORE18002000T")); }