HtmlResultsWriter implements ResultsWriter { @Override public String writeString(ModeOfInheritance modeOfInheritance, Analysis analysis, AnalysisResults analysisResults, OutputSettings settings) { logger.debug("Writing HTML results"); Context context = buildContext(modeOfInheritance, analysis, analysisResults, settings); return templateEngine.process("results", context); } HtmlResultsWriter(); @Override void writeFile(ModeOfInheritance modeOfInheritance, Analysis analysis, AnalysisResults analysisResults, OutputSettings settings); @Override String writeString(ModeOfInheritance modeOfInheritance, Analysis analysis, AnalysisResults analysisResults, OutputSettings settings);  }
@Test public void testWriteTemplateWithEmptyDataAndFullAnalysis() throws Exception { AnalysisResults analysisResults = buildAnalysisResults(Collections.emptyList(), Collections.emptyList()); Analysis analysis = Analysis.builder() .hpoIds(Lists.newArrayList("HP:000001", "HP:000002")) .addStep(new RegulatoryFeatureFilter()) .addStep(new FrequencyFilter(0.1f)) .addStep(new PathogenicityFilter(true)) .addStep(new PhivePriority(TestPriorityServiceFactory.STUB_SERVICE)) .build(); OutputSettings settings = OutputSettings.builder().build(); String output = instance.writeString(ModeOfInheritance.ANY, analysis, analysisResults, settings); assertFalse(output.isEmpty()); }
@Test public void testWriteTemplateWithFullDataAndFullAnalysis() throws Exception { unAnnotatedVariantEvaluation1.setContributesToGeneScoreUnderMode(ModeOfInheritance.ANY); List<VariantEvaluation> variants = Lists.newArrayList(unAnnotatedVariantEvaluation1, unAnnotatedVariantEvaluation2); List<Gene> genes = Lists.newArrayList(fgfr2Gene, shhGene); AnalysisResults analysisResults = buildAnalysisResults(genes, variants); Analysis analysis = Analysis.builder() .hpoIds(Lists.newArrayList("HP:000001", "HP:000002")) .addStep(new RegulatoryFeatureFilter()) .addStep(new FrequencyFilter(0.1f)) .addStep(new PathogenicityFilter(true)) .addStep(new PhivePriority(TestPriorityServiceFactory.STUB_SERVICE)) .build(); OutputSettings settings = OutputSettings.builder().build(); String output = instance.writeString(ModeOfInheritance.ANY, analysis, analysisResults, settings); assertTrue(output.contains("Exomiser Analysis Results for")); assertTrue(output.contains("FGFR2")); assertTrue(output.contains("SHH")); }