use of org.eol.globi.domain.NameType in project eol-globi-data by jhpoelen.
the class GlobalNamesServiceTest method createTaxaListFromNoNameList.
@Test
public void createTaxaListFromNoNameList() throws PropertyEnricherException {
GlobalNamesService service = new GlobalNamesService(GlobalNamesSources.ITIS);
final List<Taxon> foundTaxa = new ArrayList<Taxon>();
service.findTermsForNames(Arrays.asList("1|Donald duck", "2|Mickey mouse"), new TermMatchListener() {
@Override
public void foundTaxonForName(Long nodeId, String name, Taxon taxon, NameType nameType) {
assertNotNull(nodeId);
assertThat(nameType, is(NameType.NONE));
foundTaxa.add(taxon);
}
});
assertThat(foundTaxa.size(), is(2));
}
use of org.eol.globi.domain.NameType in project eol-globi-data by jhpoelen.
the class GlobalNamesServiceTest method lookupNCBIPrune.
@Test
public void lookupNCBIPrune() throws PropertyEnricherException {
GlobalNamesService service = new GlobalNamesService(Arrays.asList(GlobalNamesSources.NCBI));
final List<Taxon> taxa = new ArrayList<>();
service.findTermsForNames(Collections.singletonList("Klebsiella pneumoniae"), new TermMatchListener() {
@Override
public void foundTaxonForName(Long nodeId, String name, Taxon taxon, NameType nameType) {
taxa.add(taxon);
assertThat(nameType, is(NameType.SAME_AS));
}
});
assertThat(taxa.size(), is(1));
assertThat(taxa.get(0).getPath(), endsWith("Klebsiella | Klebsiella pneumoniae"));
}
use of org.eol.globi.domain.NameType in project eol-globi-data by jhpoelen.
the class GlobalNamesServiceTest method createTaxaListFromNameListNCBI.
@Test
public void createTaxaListFromNameListNCBI() throws PropertyEnricherException {
GlobalNamesService service = new GlobalNamesService(GlobalNamesSources.NCBI);
final List<Taxon> foundTaxa = new ArrayList<Taxon>();
service.findTermsForNames(Collections.singletonList("1|Prunus persica L."), new TermMatchListener() {
@Override
public void foundTaxonForName(Long nodeId, String name, Taxon taxon, NameType nameType) {
assertNotNull(nodeId);
foundTaxa.add(taxon);
}
});
assertThat(foundTaxa.size(), is(1));
assertThat(foundTaxa.get(0).getExternalId(), is(TaxonomyProvider.NCBI.getIdPrefix() + "3760"));
}
Aggregations