private SelectResults helpTestFunctionalIndexForQuery(String query, String indexedExpression,
      String regionPath, AbstractTestHook testHook, int expectedSize) throws Exception {
    MyQueryObserverAdapter observer = new MyQueryObserverAdapter();
    QueryObserverHolder.setInstance(observer);
    IndexManager.testHook = testHook;
    QueryService qs = CacheUtils.getQueryService();
    Index index = qs.createIndex("testIndex", indexedExpression, regionPath);
    SelectResults indexedResults = (SelectResults) qs.newQuery(query).execute();
    for (final Object row : indexedResults) {
      if (row instanceof Struct) {
        Object[] fields = ((Struct) row).getFieldValues();
        for (Object field : fields) {
          assertTrue(field != QueryService.UNDEFINED);
          if (field instanceof String) {
            assertTrue(((String) field).compareTo(newValue) != 0);
          }
        }
      } else {
        assertTrue(row != QueryService.UNDEFINED);
        if (row instanceof String) {
          assertTrue(((String) row).compareTo(newValue) != 0);
        }
      }
    }
    assertTrue(indexedResults.size() >= expectedSize);
    assertTrue(observer.indexUsed);
    assertTrue(((AbstractTestHook) IndexManager.testHook).isTestHookCalled());
    ((AbstractTestHook) IndexManager.testHook).reset();
    qs.removeIndex(index);

    return indexedResults;
  }
helper method to test against a functional index make sure there is no UNDEFINED result
geode-core/src/integrationTest/java/org/apache/geode/cache/query/functional/IndexOnEntrySetJUnitTest.java