SummaryModel { @NotNull public String findSummaryForSample(@NotNull String sample) { boolean sampleHasSummary = samplePresentInSummaries(sample); LimsCoreCohort coreCohort = LimsCoreCohort.fromSampleId(sample); LimsStudy study = LimsStudy.fromSampleId(sample); if (!sampleHasSummary && LimsStudy.fromSampleId(sample) == LimsStudy.WIDE) { LOGGER.warn("Could not find a summary for WIDE sample: {}", sample); } else if (study == LimsStudy.CORE && !sampleHasSummary && coreCohort != LimsCoreCohort.CORELR02 && coreCohort != LimsCoreCohort.CORERI02) { LOGGER.warn("Could not find a summary for CORE sample: {}", sample); } return sampleHasSummary ? sampleToSummaryMap.get(sample) : Strings.EMPTY; } SummaryModel(@NotNull final Map<String, String> sampleToSummaryMap); @NotNull String findSummaryForSample(@NotNull String sample);  }
@Test public void canExtractSummaryOfSample() { Map<String, String> summaryToSampleMap = Maps.newHashMap(); summaryToSampleMap.put("sample", "this is a test summary"); SummaryModel summaryModel = new SummaryModel(summaryToSampleMap); assertEquals("this is a test summary", summaryModel.findSummaryForSample("sample")); assertNotEquals("this is a test summary", summaryModel.findSummaryForSample("sample2")); }