Search in sources :

Example 1 with TeachesAt

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();
}
Also used : TeachesAt(org.neo4j.ogm.domain.education.TeachesAt) Teacher(org.neo4j.ogm.domain.education.Teacher) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Teacher (org.neo4j.ogm.domain.education.Teacher)1 TeachesAt (org.neo4j.ogm.domain.education.TeachesAt)1