SampleReportFactory { @VisibleForTesting @Nullable static String toHospitalPathologySampleIdForReport(@NotNull String hospitalPathologySampleId, @NotNull String tumorSampleId) { LimsStudy study = LimsStudy.fromSampleId(tumorSampleId); if (study == LimsStudy.CORE || study == LimsStudy.WIDE) { if (!hospitalPathologySampleId.equals(Lims.NOT_AVAILABLE_STRING) && !hospitalPathologySampleId.isEmpty() && isValidHospitalPathologySampleId(hospitalPathologySampleId)) { return hospitalPathologySampleId; } else { if (study == LimsStudy.WIDE) { LOGGER.warn("Missing or invalid hospital pathology sample ID for sample '{}': {}. Please fix!", tumorSampleId, hospitalPathologySampleId); } else { if (!hospitalPathologySampleId.isEmpty()) { LOGGER.warn("No valid hospital pathology sample ID found for '{}': {}", tumorSampleId, hospitalPathologySampleId); } } return null; } } else { if (!hospitalPathologySampleId.isEmpty() && !hospitalPathologySampleId.equals(Lims.NOT_AVAILABLE_STRING)) { LOGGER.info("Skipping hospital pathology sample ID for sample '{}': {}", hospitalPathologySampleId, tumorSampleId); } return null; } } private  SampleReportFactory(); @NotNull static SampleReport fromLimsModel(@NotNull SampleMetadata sampleMetadata, @NotNull Lims lims,
            @Nullable PatientTumorLocation patientTumorLocation);  }
@Test public void canConvertHospitalPathologySampleId() { String wideSampleId = "WIDE020000001T"; String cpctSampleId = "CPCT020000001T"; String coreSampleId = "CORE020000001T"; String correctIdT = "T20-72346"; String correctIdC = "C18-00124"; String wrongId = "BGr-12111"; assertEquals(correctIdT, SampleReportFactory.toHospitalPathologySampleIdForReport(correctIdT, wideSampleId)); assertEquals(correctIdC, SampleReportFactory.toHospitalPathologySampleIdForReport(correctIdC, wideSampleId)); assertNull(SampleReportFactory.toHospitalPathologySampleIdForReport(wrongId, wideSampleId)); assertNull(SampleReportFactory.toHospitalPathologySampleIdForReport(Lims.NOT_AVAILABLE_STRING, wideSampleId)); assertNull(SampleReportFactory.toHospitalPathologySampleIdForReport(Strings.EMPTY, wideSampleId)); assertNull(SampleReportFactory.toHospitalPathologySampleIdForReport(Strings.EMPTY, coreSampleId)); assertEquals(correctIdT,SampleReportFactory.toHospitalPathologySampleIdForReport(correctIdT, coreSampleId)); assertNull(SampleReportFactory.toHospitalPathologySampleIdForReport(wrongId, coreSampleId)); assertNull(correctIdT, SampleReportFactory.toHospitalPathologySampleIdForReport(correctIdT, cpctSampleId)); assertNull(correctIdC, SampleReportFactory.toHospitalPathologySampleIdForReport(correctIdC, cpctSampleId)); }