@Test
 public void testNodeCanbBeIndexedTwiceInDifferentTransactions() {
   Transaction tx = null;
   final Person p;
   try {
     tx = neo4jTemplate.getGraphDatabase().beginTx();
     p = persistedPerson(NAME_VALUE2, 30);
     tx.success();
   } finally {
     if (tx != null) tx.close();
   }
   Assert.assertEquals(p, personRepository.findByPropertyValue(NAME_INDEX, "name", NAME_VALUE2));
   try {
     tx = neo4jTemplate.getGraphDatabase().beginTx();
     p.setName(NAME_VALUE);
     tx.success();
   } finally {
     tx.close();
   }
   Assert.assertEquals(p, personRepository.findByPropertyValue(NAME_INDEX, "name", NAME_VALUE));
   try {
     tx = neo4jTemplate.getGraphDatabase().beginTx();
     p.setName(NAME_VALUE2);
     tx.success();
   } finally {
     tx.close();
   }
   Assert.assertEquals(p, personRepository.findByPropertyValue(NAME_INDEX, "name", NAME_VALUE2));
 }
 @Test
 @Transactional
 public void testFindAllPersonByIndexOnAnnotatedFieldWithAtIndexed() {
   Person person = persistedPerson(NAME_VALUE, 35);
   person.setNickname("Mike");
   final Person found = this.personRepository.findByPropertyValue("nickname", "Mike");
   assertEquals(person, found);
 }
 @Test
 @Transactional
 public void testGetRelationshipFromLookedUpNode() {
   Person me = persistedPerson(NAME_VALUE, 35);
   Person spouse = persistedPerson(NAME_VALUE3, 36);
   me.setSpouse(spouse);
   final Person foundMe =
       this.personRepository.findByPropertyValue(NAME_INDEX, "name", NAME_VALUE);
   assertEquals(spouse, foundMe.getSpouse());
 }
 @Test
 @Transactional
 public void testNodeCanbBeIndexedTwice() {
   final Person p = persistedPerson(NAME_VALUE2, 30);
   Assert.assertEquals(p, personRepository.findByPropertyValue(NAME_INDEX, "name", NAME_VALUE2));
   p.setName(NAME_VALUE);
   Assert.assertEquals(p, personRepository.findByPropertyValue(NAME_INDEX, "name", NAME_VALUE));
   p.setName(NAME_VALUE2);
   Assert.assertEquals(p, personRepository.findByPropertyValue(NAME_INDEX, "name", NAME_VALUE2));
 }
 @Test
 @Transactional
 @Ignore
 public void testCanIndexIntFieldsOnRelationshipEntities() {
   Person p = persistedPerson(NAME_VALUE, 35);
   Person p2 = persistedPerson(NAME_VALUE2, 25);
   Friendship friendship = p.knows(p2);
   friendship.setYears(1);
   GraphRepository<Friendship> friendshipFinder = neo4jTemplate.repositoryFor(Friendship.class);
   assertEquals(friendship, friendshipFinder.findByPropertyValue("Friendship.years", 1));
 }
 @SuppressWarnings("unchecked")
 @Test
 @Transactional
 public void testQueryVariableRelationshipSingleResult() throws Exception {
   final Collection<Map<String, Object>> result =
       IteratorUtil.asCollection(michael.getOtherTeamMemberData());
   assertThat(
       result,
       hasItems(
           testTeam.simpleRowFor(testTeam.emil, "member"),
           testTeam.simpleRowFor(testTeam.david, "member")));
 }
 @Test
 public void testQueryVariableStringResult() throws Exception {
   assertEquals(testTeam.emil.getName(), michael.getBossName());
 }
 @Test
 public void testQueryVariableSingleResultPerson() throws Exception {
   assertEquals(testTeam.emil, michael.getBossByQuery());
 }
  @Test
  public void testQueryVariableRelationshipIterableResult() throws Exception {
    final Collection<Person> result = IteratorUtil.asCollection(michael.getOtherTeamMembers());

    assertThat(result, hasItems(testTeam.david, testTeam.emil));
  }