FilterReportFactory { private FilterReport makeIntervalFilterReport(IntervalFilter filter, List<VariantEvaluation> variantEvaluations) { List<ChromosomalRegion> chromosomalRegions = filter.getChromosomalRegions(); List<String> messages = new ArrayList<>(); if (chromosomalRegions.size() == 1) { messages.add("Restricted variants to interval:"); } else { messages.add("Restricted variants to intervals:"); } int regionsToShow = 5; if (chromosomalRegions.size() <= regionsToShow) { for (ChromosomalRegion chromosomalRegion : chromosomalRegions) { messages.add(formatRegion(chromosomalRegion)); } } else { for (int i = 0; i < regionsToShow - 2 ; i++) { ChromosomalRegion region = chromosomalRegions.get(i); messages.add(formatRegion(region)); } messages.add("..."); ChromosomalRegion finalRegion = chromosomalRegions.get(chromosomalRegions.size() - 1); messages.add(formatRegion(finalRegion)); } return makeVariantFilterReport(filter, variantEvaluations, messages); } FilterReportFactory(); List<FilterReport> makeFilterReports(Analysis analysis, AnalysisResults analysisResults);  }
@Test public void testMakeIntervalFilterReport() { GeneticInterval interval = new GeneticInterval(1, 2, 3); Filter filter = new IntervalFilter(interval); FilterType filterType = FilterType.INTERVAL_FILTER; ImmutableList<String> messages = ImmutableList.of("Restricted variants to interval:", "1:2-3"); FilterReport report = new FilterReport(filterType, 0, 0, messages); FilterReport result = instance.makeFilterReport(filter, analysisResults); assertThat(result, equalTo(report)); }