GenomeAnalysisServiceProvider { public GenomeAnalysisService get(GenomeAssembly genomeAssembly) { if (hasServiceFor(genomeAssembly)) { return genomeAnalysisServices.get(genomeAssembly); } throw new UnsupportedGenomeAssemblyException(String.format("Genome assembly %s is not configured for this exomiser instance. Supported assemblies are: %s", genomeAssembly, getProvidedAssemblies())); } GenomeAnalysisServiceProvider(GenomeAnalysisService... genomeAnalysisServices); Set<GenomeAssembly> getProvidedAssemblies(); GenomeAnalysisService get(GenomeAssembly genomeAssembly); GenomeAnalysisService getOrDefault(GenomeAssembly genomeAssembly, GenomeAnalysisService defaultAnalysisService); boolean hasServiceFor(GenomeAssembly genomeAssembly); @Override String toString();  }
@Test public void testCanAddAlternateServices() { GenomeAnalysisServiceProvider instance = new GenomeAnalysisServiceProvider(HG19_SERVICE, HG38_SERVICE); assertThat(instance.get(GenomeAssembly.HG38), equalTo(HG38_SERVICE)); }
@Test public void testGetReturnsExpectedService() { GenomeAssembly defaultAssembly = HG19_SERVICE.getGenomeAssembly(); GenomeAnalysisServiceProvider instance = new GenomeAnalysisServiceProvider(HG19_SERVICE); assertThat(instance.get(defaultAssembly), equalTo(HG19_SERVICE)); }