@Test
  public void testIndexObjectTypeWithRegionConstraint() throws Exception {
    QueryService qs;
    qs = CacheUtils.getQueryService();
    Index i1 = qs.createIndex("Index1", IndexType.FUNCTIONAL, "b.secId",
        SEPARATOR + "portfolios pf, pf.positions.values b");
    ObjectType type = ((IndexProtocol) i1).getResultSetType();
    String[] fieldNames = {"index_iter1", "index_iter2"};
    ObjectType[] fieldTypes =
        {new ObjectTypeImpl(Portfolio.class), new ObjectTypeImpl(Object.class)};
    // ObjectType expectedType = new StructTypeImpl( fieldNames,fieldTypes);
    ObjectType expectedType = new StructTypeImpl(fieldNames, fieldTypes);
    if (!(type instanceof StructType && type.equals(expectedType))) {
      fail(
          "The ObjectType obtained from index is not of the expected type. Type obtained from index="
              + type);
    }

    Index i2 =
        qs.createIndex("Index2", IndexType.FUNCTIONAL, "pf.ID", SEPARATOR + "portfolios.values pf");
    type = ((IndexProtocol) i2).getResultSetType();

    expectedType = new ObjectTypeImpl(Portfolio.class);
    if (!type.equals(expectedType)) {
      fail(
          "The ObjectType obtained from index is not of the expected type. Type obtained from index="
              + type);
    }

    Index i3 = qs.createIndex("Index3", IndexType.FUNCTIONAL, "pos.secId",
        SEPARATOR + "portfolios['0'].positions.values pos");
    type = ((IndexProtocol) i3).getResultSetType();

    expectedType = new ObjectTypeImpl(Object.class);
    if (!type.equals(expectedType)) {
      fail(
          "The ObjectType obtained from index is not of the expected type. Type obtained from index="
              + type);
    }

    Index i4 = qs.createIndex("Index4", IndexType.PRIMARY_KEY, "ID", SEPARATOR + "portfolios");
    type = ((IndexProtocol) i4).getResultSetType();

    expectedType = new ObjectTypeImpl(Portfolio.class);
    if (!type.equals(expectedType)) {
      fail(
          "The ObjectType obtained from index is not of the expected type. Type obtained from index="
              + type);
    }
  }
Test the Index maiantenance as it may use the method keys() of QRegion instead of DummyQRegion
while running an IndexMaintenanceQuery
geode-core/src/integrationTest/java/org/apache/geode/cache/query/functional/IndexCreationJUnitTest.java