AnalysisParser { public OutputSettings parseOutputSettings(Path analysisScript) { Map settingsMap = loadMap(analysisScript); return constructOutputSettingsFromMap(settingsMap); } @Autowired  AnalysisParser(GenomeAnalysisServiceProvider genomeAnalysisServiceProvider, PriorityFactory prioritiserFactory, OntologyService ontologyService); Analysis parseAnalysis(Path analysisScript); Analysis parseAnalysis(String analysisDoc); OutputSettings parseOutputSettings(Path analysisScript); OutputSettings parseOutputSettings(String analysisDoc);  }
@Test public void testParseOutputSettingsNonExistentFile() { assertThrows(AnalysisFileNotFoundException.class, () -> instance.parseOutputSettings(Paths.get("src/test/resources/wibble")) ); }
@Test public void testParseOutputSettingsOutputPassVariantsOnlyThrowsExceptionWithNoValue() { assertThrows(AnalysisParserException.class, () -> instance.parseOutputSettings( "outputOptions:\n" + " outputPassVariantsOnly: ") ); }
@Test public void testParseOutputSettingsOutputPassVariantsOnly() { OutputSettings outputSettings = instance.parseOutputSettings( "outputOptions:\n" + " outputPassVariantsOnly: true\n" + " numGenes: 1\n" + " outputPrefix: results/Pfeiffer-hiphive\n" + " outputFormats: [HTML, TSV-GENE, TSV-VARIANT, VCF]\n"); assertThat(outputSettings.outputContributingVariantsOnly(), is(true)); }
@Test public void testParseOutputSettingsNumGenesToShow() { OutputSettings outputSettings = instance.parseOutputSettings( "outputOptions:\n" + " outputPassVariantsOnly: true\n" + " numGenes: 1\n" + " outputPrefix: results/Pfeiffer-hiphive\n" + " outputFormats: [HTML, TSV-GENE, TSV-VARIANT, VCF]\n"); assertThat(outputSettings.getNumberOfGenesToShow(), equalTo(1)); }
@Test public void testParseOutputSettingsOutputPrefix() { OutputSettings outputSettings = instance.parseOutputSettings( "outputOptions:\n" + " outputPassVariantsOnly: true\n" + " numGenes: 1\n" + " outputPrefix: results/Pfeiffer-hiphive\n" + " outputFormats: [HTML, TSV-GENE, TSV-VARIANT, VCF]\n"); assertThat(outputSettings.getOutputPrefix(), equalTo("results/Pfeiffer-hiphive")); }
@Test public void testParseOutputSettingsAllSupportedOutputFormats() { OutputSettings outputSettings = instance.parseOutputSettings( "outputOptions:\n" + " outputPassVariantsOnly: true\n" + " numGenes: 1\n" + " outputPrefix: results/Pfeiffer-hiphive\n" + " outputFormats: [HTML, JSON, TSV-GENE, TSV-VARIANT, VCF]\n"); Set<OutputFormat> outputFormats = EnumSet.of(OutputFormat.HTML, OutputFormat.JSON, OutputFormat.TSV_GENE, OutputFormat.TSV_VARIANT, OutputFormat.VCF); assertThat(outputSettings.getOutputFormats(), equalTo((outputFormats))); }
@Test public void testParseOutputSettingsNoOutputFormats() { OutputSettings outputSettings = instance.parseOutputSettings( "outputOptions:\n" + " outputPassVariantsOnly: true\n" + " numGenes: 1\n" + " outputPrefix: results/Pfeiffer-hiphive\n" + " outputFormats:\n"); Set<OutputFormat> outputFormats = EnumSet.noneOf(OutputFormat.class); assertThat(outputSettings.getOutputFormats(), equalTo((outputFormats))); }
@Test public void testParseOutputSettingsUnsupportedOutputFormatDefaultsToHtml() { OutputSettings outputSettings = instance.parseOutputSettings( "outputOptions:\n" + " outputPassVariantsOnly: true\n" + " numGenes: 1\n" + " outputPrefix: results/Pfeiffer-hiphive\n" + " outputFormats: [WIBBLE!]\n"); Set<OutputFormat> outputFormats = EnumSet.of(OutputFormat.HTML); assertThat(outputSettings.getOutputFormats(), equalTo((outputFormats))); }
@Test public void testParseOutputSettings() { OutputSettings outputSettings = instance.parseOutputSettings(Paths.get("src/test/resources/analysisExample.yml")); OutputSettings expected = OutputSettings.builder() .outputContributingVariantsOnly(false) .numberOfGenesToShow(0) .outputPrefix("results/Pfeiffer-hiphive") .outputFormats(EnumSet.of(OutputFormat.TSV_GENE, OutputFormat.TSV_VARIANT, OutputFormat.VCF, OutputFormat.HTML)) .build(); assertThat(outputSettings, equalTo(expected)); }