super.setBasePackage(mappingContext,Person.class.getPackage().getName());
}
@Test
public void testCreateUniqueRelationship() {
final Person p1 = storeInGraph(michael);
final Person p2 = storeInGraph(andres);
final BestFriend bestFriend = new BestFriend(p1, p2, "cypher");
template.save(bestFriend);
final Relationship bestFriendRel = template.getPersistentState(bestFriend);
assertEquals(bestFriendRel,((Node)template.getPersistentState(michael)).getSingleRelationship(DynamicRelationshipType.withName("BEST_FRIEND"), Direction.OUTGOING));
assertEquals(bestFriendRel.getEndNode(), template.getPersistentState(andres));
assertEquals("cypher",bestFriendRel.getProperty("secretName"));
assertEquals(bestFriendRel, getBestFriend());
final Person p3 = storeInGraph(emil);
final BestFriend bestFriend2 = new BestFriend(p1, p3, "cypher");
template.save(bestFriend2);
final Relationship bestFriend2Rel = template.getPersistentState(bestFriend2);
assertEquals(bestFriend2Rel, bestFriendRel);