@Test
  public void testQueryMethod_4() throws Exception {
    QueryService qs;
    qs = CacheUtils.getQueryService();
    AbstractIndex i1 =
        (AbstractIndex) qs.createIndex("idIndex", IndexType.FUNCTIONAL, "ID",
            SEPARATOR + "portfolios");
    AbstractIndex i2 = (AbstractIndex) qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "status",
        SEPARATOR + "portfolios");
    AbstractIndex i3 = (AbstractIndex) qs.createIndex("status.toString()", IndexType.FUNCTIONAL,
        "status.toString", SEPARATOR + "portfolios");
    Set results = new HashSet();
    DefaultQuery q =
        new DefaultQuery("select * from " + SEPARATOR + "portfolios", CacheUtils.getCache(), false);
    q.setRemoteQuery(false);
    ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache(), q);
    bindIterators(context, SEPARATOR + "portfolios");

    Set keysToRemove = new HashSet();
    keysToRemove.add(5);
    i1.query(results, keysToRemove, context);
    assertEquals(11, results.size());
    for (int i = 0; i < 12;) {
      if (i != 5) {
        assertTrue(results.contains(region.get(i)));
      }
      ++i;
    }

    results.clear();
    keysToRemove.clear();
    keysToRemove.add(5);
    keysToRemove.add(8);
    i1.query(results, keysToRemove, context);
    assertEquals(10, results.size());
    for (int i = 0; i < 12;) {
      if (i != 5 && i != 8) {
        assertTrue(results.contains(region.get(i)));
      }
      ++i;
    }

    results.clear();
    keysToRemove.clear();
    keysToRemove.add("active");
    keysToRemove.add("inactive");
    i2.query(results, keysToRemove, context);
    assertEquals(2, results.size());
    for (int i = 10; i < 12;) {
      assertTrue(results.contains(region.get(i)));
      ++i;
    }
  }
Tests the query method of RangeIndex which just contains not equal keys. That is if the where
clause looks like a != 7 and a != 8 & a!=9
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/RangeIndexAPIJUnitTest.java