@Test
  public void testNullorNotNullorUndefinedBehaviour() {
    LogWriter logger = CacheUtils.getLogger();
    try {
      CompiledComparison[] cv = null;
      ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache());
      bindIteratorsAndCreateIndex(context);
      // Case 1 : a >= 7 and a != null
      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(null), OQLLexerTokenTypes.TOK_EQ);
      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(oo1.filterOperand instanceof GroupJunction);
      CompiledValue[] operands = ((GroupJunction) oo1.filterOperand)._operands;
      assertEquals(2, operands.length);
      assertTrue(operands[0] == cv[0] || operands[0] == cv[1]);
      assertTrue(operands[1] == cv[0] || operands[1] == cv[1]);

      // Case 2 : a >= 7 and a != null and a!=5
      cv = new CompiledComparison[3];
      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(null), OQLLexerTokenTypes.TOK_NE);
      cv[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(5), 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 GroupJunction);
      operands = ((GroupJunction) oo1.filterOperand)._operands;
      assertEquals(2, operands.length);
      assertTrue(cv[1] == operands[0] || cv[1] == operands[1]);
      assertTrue(cv[0] == operands[0] || cv[0] == operands[1]);
      // Case 3 : a >= 7 and a != null and a!=7
      cv = new CompiledComparison[3];
      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(null), OQLLexerTokenTypes.TOK_NE);
      cv[2] = 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 GroupJunction);
      operands = ((GroupJunction) oo1.filterOperand)._operands;
      assertEquals(2, operands.length);
      assertTrue(cv[1] == operands[0] || cv[1] == operands[1]);
      assertTrue(RangeJunction.isInstanceOfSingleCondnEvaluator(operands[0])
          || RangeJunction.isInstanceOfSingleCondnEvaluator(operands[1]));
      int x = -1;
      if (RangeJunction.isInstanceOfSingleCondnEvaluator(operands[0])) {
        x = 0;
      } else if (RangeJunction.isInstanceOfSingleCondnEvaluator(operands[1])) {
        x = 1;
      }

      Object key = RangeJunction.getSingleCondnEvaluatorKey(operands[x]);
      assertTrue(key.equals(7));
      assertTrue(
          RangeJunction.getSingleCondnEvaluatorOperator(operands[x]) == OQLLexerTokenTypes.TOK_GE);
      assertTrue(RangeJunction.getKeysToBeRemoved(operands[x]).size() == 1);
      assertTrue(
          RangeJunction.getKeysToBeRemoved(operands[x]).iterator().next().equals(7));

      // Case 4 : a >= 7 and a == null and a!=7 and a = undefined
      CompiledValue[] cv1 = new CompiledValue[4];
      cv1[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(7), OQLLexerTokenTypes.TOK_GE);
      cv1[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(null), OQLLexerTokenTypes.TOK_EQ);
      cv1[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(7), OQLLexerTokenTypes.TOK_NE);
      cv1[3] = new CompiledUndefined(new CompiledPath(new CompiledID("p"), "ID"), false);
      oo = oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv1,
          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 GroupJunction);
      assertEquals(((GroupJunction) oo1.filterOperand)._operands.length, 3);
      CompiledValue[] ops = ((GroupJunction) oo1.filterOperand)._operands;
      assertTrue(ops[0] == cv1[1] || ops[1] == cv1[1] || ops[2] == cv1[1]);
      assertTrue(ops[0] == cv1[3] || ops[1] == cv1[3] || ops[2] == cv1[3]);
      assertTrue(RangeJunction.isInstanceOfSingleCondnEvaluator(ops[0])
          || RangeJunction.isInstanceOfSingleCondnEvaluator(ops[1])
          || RangeJunction.isInstanceOfSingleCondnEvaluator(ops[2]));
      x = -1;
      if (RangeJunction.isInstanceOfSingleCondnEvaluator(ops[0])) {
        x = 0;
      } else if (RangeJunction.isInstanceOfSingleCondnEvaluator(ops[1])) {
        x = 1;
      } else if (RangeJunction.isInstanceOfSingleCondnEvaluator(ops[2])) {
        x = 2;
      }
      key = RangeJunction.getSingleCondnEvaluatorKey(ops[x]);
      assertTrue(key.equals(7));
      assertTrue(
          RangeJunction.getSingleCondnEvaluatorOperator(ops[x]) == OQLLexerTokenTypes.TOK_GE);
      assertTrue(RangeJunction.getKeysToBeRemoved(ops[x]).size() == 1);
      assertTrue(RangeJunction.getKeysToBeRemoved(ops[x]).iterator().next().equals(7));

      // Case 5 : a >= 7 and a == null and a == 6 and a = undefined and
      // createTime = 6
      cv1 = new CompiledValue[5];
      cv1[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(7), OQLLexerTokenTypes.TOK_GE);
      cv1[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(null), OQLLexerTokenTypes.TOK_EQ);
      cv1[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(6), OQLLexerTokenTypes.TOK_EQ);
      cv1[3] = new CompiledUndefined(new CompiledPath(new CompiledID("p"), "ID"), false);
      cv1[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "createTime"),
          new CompiledLiteral(6L), OQLLexerTokenTypes.TOK_EQ);
      oo = oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv1,
          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));
      assertNull(oo1.iterateOperand);

      // Case 6 : a >= 7 and a == null and a == 8 and a = undefined and
      // createTime = 6
      cv1 = new CompiledValue[5];
      cv1[0] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(7), OQLLexerTokenTypes.TOK_GE);
      cv1[1] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(null), OQLLexerTokenTypes.TOK_EQ);
      cv1[2] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "ID"),
          new CompiledLiteral(8), OQLLexerTokenTypes.TOK_EQ);
      cv1[3] = new CompiledUndefined(new CompiledPath(new CompiledID("p"), "ID"), false);
      cv1[4] = new CompiledComparison(new CompiledPath(new CompiledID("p"), "createTime"),
          new CompiledLiteral(6L), OQLLexerTokenTypes.TOK_EQ);
      oo = oganizedOperandsSingleRangeJunctionCreation(OQLLexerTokenTypes.LITERAL_and, cv1,
          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 GroupJunction);
      operands = ((GroupJunction) oo1.filterOperand)._operands;
      assertEquals(operands.length, 3);
      assertTrue(cv1[1] == operands[0] || cv1[1] == operands[1] || cv1[1] == operands[2]);
      assertTrue(cv1[2] == operands[0] || cv1[2] == operands[1] || cv1[2] == operands[2]);
      assertTrue(cv1[3] == operands[0] || cv1[3] == operands[1] || cv1[3] == operands[2]);
      assertTrue(oo1.iterateOperand == cv1[4]);

    } catch (Exception e) {
      logger.error(e.toString());
      fail(e.toString());
    }
  }
Tests if the presence of UNDEFINED operand is treated as a separate eval operand & not made a
part of SingleCondn or DoubleCondn evaluator
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/CompiledJunctionInternalsJUnitTest.java