OntologyServiceImpl implements OntologyService { @Override public List<String> getCurrentHpoIds(List<String> hpoIds) { return hpoIds.stream() .map(hpoIdChecker::getCurrentId) .distinct() .collect(Collectors.toList()); } @Autowired  OntologyServiceImpl(HumanPhenotypeOntologyDao hpoDao, MousePhenotypeOntologyDao mpoDao, ZebraFishPhenotypeOntologyDao zpoDao); @Cacheable(value = "hpo") @Override Set<PhenotypeTerm> getHpoTerms(); @Cacheable(value = "mpo") @Override Set<PhenotypeTerm> getMpoTerms(); @Cacheable(value = "zpo") @Override Set<PhenotypeTerm> getZpoTerms(); @Override Set<PhenotypeMatch> getHpoMatchesForHpoTerm(PhenotypeTerm hpoTerm); @Override Set<PhenotypeMatch> getMpoMatchesForHpoTerm(PhenotypeTerm hpoTerm); @Override Set<PhenotypeMatch> getZpoMatchesForHpoTerm(PhenotypeTerm hpoTerm); @Override PhenotypeTerm getPhenotypeTermForHpoId(String hpoId); @Override List<String> getCurrentHpoIds(List<String> hpoIds);  }
@Test void testReturnsSameHpoIdsWhenGivenObsoleteIdsAndAltHpIdsNotAvailable() { Mockito.when(mockHpoDao.getIdToPhenotypeTerms()) .thenReturn(ImmutableMap.of()); instance = new OntologyServiceImpl(mockHpoDao, mockMpoDao, mockZpoDao); assertThat(instance.getCurrentHpoIds(ImmutableList.of("HP:0009902", "HP:0000000")), equalTo(ImmutableList.of("HP:0009902", "HP:0000000"))); assertThat(instance.getCurrentHpoIds(ImmutableList.of("HP:0009902", "HP:0009905", "HP:0000000")), equalTo(ImmutableList.of("HP:0009902", "HP:0009905", "HP:0000000"))); }
@Test void testReturnsCurrentHpoIdsWhenGivenObsoleteIds() { String obsoleteThinEarHelixId = "HP:0000000"; String currentThinEarHelixId = "HP:0009905"; Mockito.when(mockHpoDao.getIdToPhenotypeTerms()) .thenReturn(ImmutableMap.of( "HP:0009902", cleftHelix, currentThinEarHelixId, thinEarHelix, obsoleteThinEarHelixId, thinEarHelix )); instance = new OntologyServiceImpl(mockHpoDao, mockMpoDao, mockZpoDao); ImmutableList<String> expected = ImmutableList.of("HP:0009902", currentThinEarHelixId); assertThat(instance.getCurrentHpoIds(ImmutableList.of("HP:0009902", obsoleteThinEarHelixId)), equalTo(expected)); assertThat(instance.getCurrentHpoIds(ImmutableList.of("HP:0009902", currentThinEarHelixId, obsoleteThinEarHelixId)), equalTo(expected)); }