@Test
  public void testDoubleCondnRangeJunctionEvaluator_AND() {
    LogWriter logger = CacheUtils.getLogger();
    try {
      CompiledComparison[] cv = null;
      ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
      bindIteratorsAndCreateIndex(context);
      // Case 1 : a >= 7 and a <=10
      cv = new CompiledComparison[2];
      cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(7), OQLLexerTokenTypes.TOK_GE);
      cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(10), OQLLexerTokenTypes.TOK_LE);
      OrganizedOperands oo =
          oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv, context);
      assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
          oo.filterOperand instanceof RangeJunction);
      RangeJunction rj = (RangeJunction) oo.filterOperand;
      OrganizedOperands oo1 = rj.organizeOperands(context);
      assertTrue(RangeJunction.isInstanceOfDoubleCondnRangeJunctionEvaluator((oo1.filterOperand)));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorGreaterKey((oo1.filterOperand))
          .equals(7));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorOperatorOfGreaterType(
          (oo1.filterOperand)) == OQLLexerTokenTypes.TOK_GE);
      assertTrue(RangeJunction.getDoubleCondnEvaluatorLESSKey((oo1.filterOperand))
          .equals(10));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorOperatorOfLessType(
          (oo1.filterOperand)) == OQLLexerTokenTypes.TOK_LE);
      assertTrue(RangeJunction.getKeysToBeRemoved((oo1.filterOperand)) == null);

      // Case2 : a >= 7 and a <=10 a >=5 and a <=11 and a != 7
      cv = new CompiledComparison[5];
      cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(7), OQLLexerTokenTypes.TOK_GE);
      cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(10), OQLLexerTokenTypes.TOK_LE);
      cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(5), OQLLexerTokenTypes.TOK_GE);
      cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(11), OQLLexerTokenTypes.TOK_LE);
      cv[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(7), OQLLexerTokenTypes.TOK_NE);
      oo = oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv,
          context);
      assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
          oo.filterOperand instanceof RangeJunction);
      rj = (RangeJunction) oo.filterOperand;
      oo1 = rj.organizeOperands(context);
      assertTrue(RangeJunction.isInstanceOfDoubleCondnRangeJunctionEvaluator((oo1.filterOperand)));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorGreaterKey((oo1.filterOperand))
          .equals(7));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorOperatorOfGreaterType(
          (oo1.filterOperand)) == OQLLexerTokenTypes.TOK_GE);
      assertTrue(RangeJunction.getDoubleCondnEvaluatorLESSKey((oo1.filterOperand))
          .equals(10));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorOperatorOfLessType(
          (oo1.filterOperand)) == OQLLexerTokenTypes.TOK_LE);
      Set keysToRemove = RangeJunction.getKeysToBeRemoved((oo1.filterOperand));
      assertTrue(keysToRemove.size() == 1);
      assertTrue(keysToRemove.iterator().next().equals(7));

      // Case3 : a >= 7 and a <=6 and a >=8 and a <=5 and a != 7
      cv = new CompiledComparison[5];
      cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(7), OQLLexerTokenTypes.TOK_GE);
      cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(6), OQLLexerTokenTypes.TOK_LE);
      cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(8), OQLLexerTokenTypes.TOK_GE);
      cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(5), OQLLexerTokenTypes.TOK_LE);
      cv[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(7), OQLLexerTokenTypes.TOK_NE);
      oo = oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv,
          context);
      assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
          oo.filterOperand instanceof RangeJunction);
      rj = (RangeJunction) oo.filterOperand;
      oo1 = rj.organizeOperands(context);
      assertTrue(oo1.filterOperand instanceof CompiledLiteral);
      assertFalse(
          (Boolean) ((CompiledLiteral) oo1.filterOperand).evaluate(context));

      // Case4 : a >= 7 and a <=6 and a >=8 and a <=5
      cv = new CompiledComparison[4];
      cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(7), OQLLexerTokenTypes.TOK_GE);
      cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(6), OQLLexerTokenTypes.TOK_LE);
      cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(8), OQLLexerTokenTypes.TOK_GE);
      cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(5), OQLLexerTokenTypes.TOK_LE);
      oo = oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv,
          context);
      assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
          oo.filterOperand instanceof RangeJunction);
      rj = (RangeJunction) oo.filterOperand;
      oo1 = rj.organizeOperands(context);
      assertTrue(oo1.filterOperand instanceof CompiledLiteral);
      assertFalse(
          (Boolean) ((CompiledLiteral) oo1.filterOperand).evaluate(context));

      // Case5 : a >= 1 and a <=6 and a !=8
      cv = new CompiledComparison[3];
      cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(1), OQLLexerTokenTypes.TOK_GE);
      cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(6), OQLLexerTokenTypes.TOK_LE);
      cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(8), OQLLexerTokenTypes.TOK_NE);

      oo = oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv,
          context);
      assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
          oo.filterOperand instanceof RangeJunction);
      rj = (RangeJunction) oo.filterOperand;
      oo1 = rj.organizeOperands(context);
      assertTrue(RangeJunction.isInstanceOfDoubleCondnRangeJunctionEvaluator((oo1.filterOperand)));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorGreaterKey((oo1.filterOperand))
          .equals(1));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorOperatorOfGreaterType(
          (oo1.filterOperand)) == OQLLexerTokenTypes.TOK_GE);
      assertTrue(
          RangeJunction.getDoubleCondnEvaluatorLESSKey((oo1.filterOperand)).equals(6));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorOperatorOfLessType(
          (oo1.filterOperand)) == OQLLexerTokenTypes.TOK_LE);
      keysToRemove = RangeJunction.getKeysToBeRemoved((oo1.filterOperand));
      assertTrue(keysToRemove == null);

      // Case6 : a >= 1 and a <=6 and a !=8 and a!=2
      cv = new CompiledComparison[4];
      cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(1), OQLLexerTokenTypes.TOK_GE);
      cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(6), OQLLexerTokenTypes.TOK_LE);
      cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(8), OQLLexerTokenTypes.TOK_NE);
      cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(2), OQLLexerTokenTypes.TOK_NE);

      oo = oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv,
          context);
      assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
          oo.filterOperand instanceof RangeJunction);
      rj = (RangeJunction) oo.filterOperand;
      oo1 = rj.organizeOperands(context);
      assertTrue(RangeJunction.isInstanceOfDoubleCondnRangeJunctionEvaluator((oo1.filterOperand)));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorGreaterKey((oo1.filterOperand))
          .equals(1));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorOperatorOfGreaterType(
          (oo1.filterOperand)) == OQLLexerTokenTypes.TOK_GE);
      assertTrue(
          RangeJunction.getDoubleCondnEvaluatorLESSKey((oo1.filterOperand)).equals(6));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorOperatorOfLessType(
          (oo1.filterOperand)) == OQLLexerTokenTypes.TOK_LE);
      keysToRemove = RangeJunction.getKeysToBeRemoved((oo1.filterOperand));
      assertTrue(keysToRemove.size() == 1);
      assertTrue(keysToRemove.iterator().next().equals(2));

      // Case7 : a >= 1 and a <=6 and a !=6 and a!=0
      cv = new CompiledComparison[4];
      cv[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(1), OQLLexerTokenTypes.TOK_GE);
      cv[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(6), OQLLexerTokenTypes.TOK_LE);
      cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(6), OQLLexerTokenTypes.TOK_NE);
      cv[3] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(0), OQLLexerTokenTypes.TOK_NE);

      oo = oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv,
          context);
      assertTrue("Filter Openad of OrganizedOperand is not of type RangeJunction",
          oo.filterOperand instanceof RangeJunction);
      rj = (RangeJunction) oo.filterOperand;
      oo1 = rj.organizeOperands(context);
      assertTrue(RangeJunction.isInstanceOfDoubleCondnRangeJunctionEvaluator((oo1.filterOperand)));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorGreaterKey((oo1.filterOperand))
          .equals(1));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorOperatorOfGreaterType(
          (oo1.filterOperand)) == OQLLexerTokenTypes.TOK_GE);
      assertTrue(
          RangeJunction.getDoubleCondnEvaluatorLESSKey((oo1.filterOperand)).equals(6));
      assertTrue(RangeJunction.getDoubleCondnEvaluatorOperatorOfLessType(
          (oo1.filterOperand)) == OQLLexerTokenTypes.TOK_LE);
      keysToRemove = RangeJunction.getKeysToBeRemoved((oo1.filterOperand));
      assertTrue(keysToRemove.size() == 1);
      assertTrue(keysToRemove.iterator().next().equals(6));

    } catch (Exception e) {
      logger.error(e);
      fail(e.toString());
    }
  }
Tests the genuine range condition evaluator ( having a upper and lower bound) formed from a
RangeJunction of type AND
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/CompiledJunctionInternalsJUnitTest.java