@Test
  public void testQueryMethod_3() 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();
    i1.query(5, OQLLexerTokenTypes.TOK_GT, 10, OQLLexerTokenTypes.TOK_LT,
        results, null, context);
    assertEquals(4, results.size());
    for (int i = 6; i < 10;) {
      assertTrue(results.contains(region.get(i)));
      ++i;
    }

    results.clear();
    keysToRemove.clear();
    keysToRemove.add(10);
    keysToRemove.add(9);
    i1.query(5, OQLLexerTokenTypes.TOK_GT, 10, OQLLexerTokenTypes.TOK_LT,
        results, keysToRemove, context);
    assertEquals(3, results.size());
    for (int i = 6; i < 9;) {
      assertTrue(results.contains(region.get(i)));
      ++i;
    }

    results.clear();
    keysToRemove.clear();
    keysToRemove.add(10);
    i1.query(5, OQLLexerTokenTypes.TOK_GT, 10, OQLLexerTokenTypes.TOK_LE,
        results, keysToRemove, context);
    assertEquals(4, results.size());
    for (int i = 6; i < 10;) {
      assertTrue(results.contains(region.get(i)));
      ++i;
    }
    results.clear();
    keysToRemove.clear();
    i1.query(5, OQLLexerTokenTypes.TOK_GT, 10, OQLLexerTokenTypes.TOK_LE,
        results, null, context);
    assertEquals(5, results.size());
    for (int i = 6; i < 11;) {
      assertTrue(results.contains(region.get(i)));
      ++i;
    }

    results.clear();
    keysToRemove.clear();
    i1.query(5, OQLLexerTokenTypes.TOK_GE, 10, OQLLexerTokenTypes.TOK_LE,
        results, null, context);
    assertEquals(6, results.size());
    for (int i = 5; i < 11;) {
      assertTrue(results.contains(region.get(i)));
      ++i;
    }

    results.clear();
    keysToRemove.clear();
    keysToRemove.add(5);
    i1.query(5, OQLLexerTokenTypes.TOK_GE, 10, OQLLexerTokenTypes.TOK_LE,
        results, keysToRemove, context);
    assertEquals(5, results.size());
    for (int i = 6; i < 11;) {
      assertTrue(results.contains(region.get(i)));
      ++i;
    }

    results.clear();
    keysToRemove.clear();
    keysToRemove.add(5);
    keysToRemove.add(10);
    keysToRemove.add(7);
    i1.query(5, OQLLexerTokenTypes.TOK_GE, 10, OQLLexerTokenTypes.TOK_LE,
        results, keysToRemove, context);
    assertEquals(3, results.size());
    assertTrue(results.contains(region.get(6)));
    assertTrue(results.contains(region.get(8)));
    assertTrue(results.contains(region.get(9)));
  }
Tests the query method of RangeIndex with takes a bound defined ( lower as well as upper) & may
contain NotEqaul Keys
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/RangeIndexAPIJUnitTest.java