HospitalModelFactory { @NotNull @VisibleForTesting static Map<String, HospitalAddress> readFromHospitalAddress(@NotNull String hospitalAddressTsv) throws IOException { Map<String, HospitalAddress> hospitalAddressMap = Maps.newHashMap(); List<String> lines = FileReader.build().readLines(new File(hospitalAddressTsv).toPath()); for (String line : lines.subList(1, lines.size())) { String[] parts = line.split(FIELD_SEPARATOR); if (parts.length == HOSPITAL_ADDRESS_FIELD_COUNT) { HospitalAddress hospitalAddress = ImmutableHospitalAddress.builder() .hospitalName(parts[HOSPITAL_ADDRESS_NAME_COLUMN]) .hospitalZip(parts[HOSPITAL_ADDRESS_ZIP_COLUMN]) .hospitalCity(parts[HOSPITAL_ADDRESS_CITY_COLUMN]) .build(); hospitalAddressMap.put(parts[HOSPITAL_ADDRESS_ID_COLUMN], hospitalAddress); } else { LOGGER.warn("Could not properly parse line in hospital address tsv: '{}'", line); } } return hospitalAddressMap; } private  HospitalModelFactory(); @NotNull static HospitalModel fromLimsDirectory(@NotNull String limsDirectory);  }
@Test public void canReadHospitalAddressTsv() throws IOException { Map<String, HospitalAddress> hospitalAddress = HospitalModelFactory.readFromHospitalAddress(LIMS_DIRECTORY + File.separator + "hospital_address.tsv"); assertEquals(2, hospitalAddress.size()); HospitalAddress address1 = hospitalAddress.get("01"); assertEquals("Ext-HMF", address1.hospitalName()); assertEquals("1000 AB", address1.hospitalZip()); assertEquals("AMSTERDAM", address1.hospitalCity()); HospitalAddress address2 = hospitalAddress.get("02"); assertEquals("Ext-HMF", address2.hospitalName()); assertEquals("1000 AB", address2.hospitalZip()); assertEquals("AMSTERDAM", address2.hospitalCity()); }