@Test
 @Transactional
 public void testFindGroupByIndex() {
   Group group = persist(new Group());
   group.setName(NAME_VALUE);
   final Group found = this.groupRepository.findByPropertyValue(NAME, NAME_VALUE);
   assertEquals(group, found);
 }
 @Test
 @Transactional
 public void testDontFindGroupByNonIndexedField() {
   Group group = persist(new Group());
   group.setUnindexedName2("value-unindexedName2");
   final Group found =
       this.groupRepository.findByPropertyValue("unindexedName2", "value-unindexedName2");
   assertNull(found);
 }
 @Test
 @Transactional
 public void testFindGroupByAlternativeFieldNameIndex() {
   Group group = persist(new Group());
   group.setOtherName(NAME_VALUE);
   final Group found =
       this.groupRepository.findByPropertyValue(Group.OTHER_NAME_INDEX, NAME_VALUE);
   assertEquals(group, found);
 }
 @Test
 @Transactional
 public void testUpdateBooleanPropertyIsReflectedInIndex() {
   Group group = persist(new Group());
   group.setAdmin(true);
   assertEquals(
       1, IteratorUtil.asCollection(groupRepository.findAllByPropertyValue("admin", true)).size());
   group.setAdmin(false);
   assertEquals(
       0, IteratorUtil.asCollection(groupRepository.findAllByPropertyValue("admin", true)).size());
 }
 @Test
 @Transactional
 public void shouldFindGroupyByQueryString() {
   Group group = persist(new Group());
   group.setFullTextName("queryableName");
   final Iterable<Group> found =
       groupRepository.findAllByQuery(Group.SEARCH_GROUPS_INDEX, "fullTextName", "queryable*");
   final Collection<Group> result =
       IteratorUtil.addToCollection(found.iterator(), new HashSet<Group>());
   assertEquals(new HashSet<>(Arrays.asList(group)), result);
 }
 @Test
 @Transactional
 public void testFindAllGroupsByIndex() {
   Group group = persist(new Group());
   group.setName(NAME_VALUE);
   Group group2 = persist(new Group());
   group2.setName(NAME_VALUE);
   final Iterable<Group> found = this.groupRepository.findAllByPropertyValue(NAME, NAME_VALUE);
   final Collection<Group> result =
       IteratorUtil.addToCollection(found.iterator(), new HashSet<Group>());
   assertEquals(new HashSet<>(Arrays.asList(group, group2)), result);
 }
 @Test
 // @Transactional
 // @Ignore("remove property from index not workin")
 public void testRemovePropertyFromIndex() {
   try (Transaction tx = neo4jTemplate.getGraphDatabase().beginTx()) {
     Group group = persist(new Group());
     group.setName(NAME_VALUE);
     getGroupIndex().remove(getNodeState(group), NAME);
     tx.success();
   }
   final Group found = this.groupRepository.findByPropertyValue(NAME, NAME_VALUE);
   assertNull("Group.name removed from index", found);
 }
 @Test
 @Transactional
 @Ignore
 public void testFindGroupByInstanceIndex() {
   Group group = persist(new SubGroup());
   group.setIndexLevelName("indexLevelNameValue");
   Index<Node> subGroupIndex = neo4jTemplate.getIndex(SubGroup.class);
   final Node found = subGroupIndex.get("indexLevelName", "indexLevelNameValue").getSingle();
   final SubGroup foundEntity =
       neo4jTemplate.createEntityFromState(
           found, SubGroup.class, neo4jTemplate.getMappingPolicy(SubGroup.class));
   assertEquals(group, foundEntity);
 }
 @Test
 @Transactional
 public void testFindAllGroupsByNonNumericIndexedNumber() {
   final Group group = new Group();
   final byte value = (byte) 100;
   group.setSecret(value);
   groupRepository.save(group);
   final PropertyContainer node = neo4jTemplate.getPersistentState(group);
   final Iterable<Group> found = this.groupRepository.findAllByPropertyValue("secret", value);
   assertEquals(1, IteratorUtil.count(found));
   final Node foundWithTemplate =
       neo4jTemplate.lookup("Group", "secret", value).to(Node.class).singleOrNull();
   assertEquals(node, foundWithTemplate);
   final Node foundGroup =
       neo4jTemplate
           .getGraphDatabaseService()
           .index()
           .forNodes("Group")
           .get("secret", value)
           .getSingle();
   assertEquals(node, foundGroup);
 }