FilterReportFactory { public List<FilterReport> makeFilterReports(Analysis analysis, AnalysisResults analysisResults) { List<Filter> filters = getFiltersFromAnalysis(analysis); return filters.stream().map(filter -> makeFilterReport(filter, analysisResults)).collect(Collectors.toList()); } FilterReportFactory(); List<FilterReport> makeFilterReports(Analysis analysis, AnalysisResults analysisResults);  }
@Test public void testMakeFilterReportsNoTypesSpecifiedReturnsEmptyList() { List<FilterReport> emptyFilterReportList = new ArrayList<>(); List<FilterReport> reports = instance.makeFilterReports(Analysis.builder().build(), analysisResults); assertThat(reports, equalTo(emptyFilterReportList)); }
@Test public void testMakeFilterReportsFrequencyPathogenicityTypesSpecifiedReturnsListWithTwoReports() { Analysis analysis = Analysis.builder() .addStep(new FrequencyFilter(0.1f)) .addStep(new PathogenicityFilter(true)) .build(); List<FilterReport> reports = instance.makeFilterReports(analysis, analysisResults); assertThat(reports.size(), equalTo(analysis.getAnalysisSteps().size())); }
@Test public void testMakeFilterReportsDecoratedFrequencyPathogenicityTypesSpecifiedReturnsListWithTwoReports() { Analysis analysis = Analysis.builder() .addStep(new FrequencyDataProvider(null, Collections.emptySet(), new KnownVariantFilter())) .addStep(new FrequencyDataProvider(null, Collections.emptySet(), new FrequencyFilter(0.1f))) .addStep(new PathogenicityDataProvider(null, Collections.emptySet(), new PathogenicityFilter(true))) .build(); List<FilterReport> reports = instance.makeFilterReports(analysis, analysisResults); assertThat(reports.size(), equalTo(analysis.getAnalysisSteps().size())); assertThat(reports.get(0).getFilterType(), equalTo(FilterType.KNOWN_VARIANT_FILTER)); assertThat(reports.get(1).getFilterType(), equalTo(FilterType.FREQUENCY_FILTER)); assertThat(reports.get(2).getFilterType(), equalTo(FilterType.PATHOGENICITY_FILTER)); }