GenomeAnalysisServiceProvider { public GenomeAnalysisService getOrDefault(GenomeAssembly genomeAssembly, GenomeAnalysisService defaultAnalysisService) { return genomeAnalysisServices.getOrDefault(genomeAssembly, defaultAnalysisService); } 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 testGetOrDefaultReturnsExpectedService() { GenomeAssembly defaultAssembly = HG19_SERVICE.getGenomeAssembly(); GenomeAnalysisServiceProvider instance = new GenomeAnalysisServiceProvider(HG19_SERVICE); assertThat(instance.getOrDefault(defaultAssembly, HG19_SERVICE), equalTo(HG19_SERVICE)); }
@Test public void testGetOrDefaultReturnsDefaultWhenRequestedAssemblyNotPresent() { GenomeAnalysisServiceProvider instance = new GenomeAnalysisServiceProvider(HG19_SERVICE); assertThat(instance.getOrDefault(GenomeAssembly.HG38, HG19_SERVICE), equalTo(HG19_SERVICE)); }