use of org.neo4j.ogm.domain.education.TeachesAt in project neo4j-ogm by neo4j.
the class IdentityMapTest method testNodeAndRelationshipWithSameId.
// GH-684
@Test
public void testNodeAndRelationshipWithSameId() {
// Create a Node and set the Id.
Teacher mrsJones = new Teacher();
mrsJones.setId(1L);
// Remember the entity.
mappingContext.addNodeEntity(mrsJones);
// Create a Relationship with the same Id.
TeachesAt teachesAtRelationship = new TeachesAt();
teachesAtRelationship.setId(1L);
IdentityMap identityMap = new IdentityMap(metaData);
identityMap.remember(mrsJones, mrsJones.getId());
assertThat(identityMap.remembered(mrsJones, mrsJones.getId())).isTrue();
assertThat(identityMap.remembered(teachesAtRelationship, teachesAtRelationship.getId())).isFalse();
identityMap.remember(teachesAtRelationship, teachesAtRelationship.getId());
assertThat(identityMap.remembered(teachesAtRelationship, teachesAtRelationship.getId())).isTrue();
}