use of org.eol.globi.data.DatasetImporterForTSV.TARGET_SEX_NAME in project eol-globi-data by jhpoelen.
the class InteractionImporterTest method importWithSex.
@Test
public void importWithSex() throws StudyImporterException {
final InteractionListener listener = getAssertingInteractionImporter();
final TreeMap<String, String> link = new TreeMap<>();
link.put(SOURCE_TAXON_NAME, "donald");
link.put(SOURCE_SEX_NAME, "female");
link.put(SOURCE_SEX_ID, "some:female");
link.put(DatasetImporterForTSV.INTERACTION_TYPE_ID, InteractType.ATE.getIRI());
link.put(TARGET_TAXON_NAME, "mini");
link.put(TARGET_SEX_NAME, "male");
link.put(TARGET_SEX_ID, "some:male");
link.put(DATASET_CITATION, "some source ref");
link.put(REFERENCE_ID, "123");
link.put(REFERENCE_CITATION, "");
listener.on(link);
AtomicInteger foundSpecimen = new AtomicInteger(0);
RelationshipListener someListener = relationship -> {
final SpecimenNode someSpecimen = new SpecimenNode(relationship.getEndNode());
assertTrue(someSpecimen.getUnderlyingNode().hasRelationship(Direction.INCOMING, NodeUtil.asNeo4j(RelTypes.COLLECTED)));
assertTrue(someSpecimen.getUnderlyingNode().hasRelationship(NodeUtil.asNeo4j(InteractType.ATE)));
if (someSpecimen.getUnderlyingNode().hasRelationship(Direction.OUTGOING, NodeUtil.asNeo4j(InteractType.ATE))) {
assertThat(someSpecimen.getSex().getName(), is("female"));
assertThat(someSpecimen.getSex().getId(), is("some:female"));
} else {
assertThat(someSpecimen.getSex().getName(), is("male"));
assertThat(someSpecimen.getSex().getId(), is("some:male"));
}
foundSpecimen.incrementAndGet();
};
handleRelations(someListener, RelTypes.COLLECTED);
assertThat(foundSpecimen.get(), is(2));
}
Aggregations