@Test
  public void testFoldMaybe() throws Exception {
    assertEquals("(and leaf-1)",
        SearchArgumentImpl.BuilderImpl.foldMaybe(and(leaf(1),
            constant(TruthValue.YES_NO_NULL))).toOldString());
    assertEquals("(and leaf-1 leaf-2)",
        SearchArgumentImpl.BuilderImpl.foldMaybe(and(leaf(1),
            constant(TruthValue.YES_NO_NULL), leaf(2))).toOldString());
    assertEquals("(and leaf-1 leaf-2)",
        SearchArgumentImpl.BuilderImpl.
            foldMaybe(and(constant(TruthValue.YES_NO_NULL),
                leaf(1), leaf(2), constant(TruthValue.YES_NO_NULL))).toOldString());
    assertEquals("YES_NO_NULL",
        SearchArgumentImpl.BuilderImpl.
            foldMaybe(and(constant(TruthValue.YES_NO_NULL),
                constant(TruthValue.YES_NO_NULL))).toOldString());
    assertEquals("YES_NO_NULL",
        SearchArgumentImpl.BuilderImpl.
            foldMaybe(or(leaf(1),
                constant(TruthValue.YES_NO_NULL))).toOldString());
    assertEquals("(or leaf-1 (and leaf-2))",
        SearchArgumentImpl.BuilderImpl.foldMaybe(or(leaf(1),
            and(leaf(2), constant(TruthValue.YES_NO_NULL)))).toOldString());
    assertEquals("(and leaf-1)",
        SearchArgumentImpl.BuilderImpl.foldMaybe(and(or(leaf(2),
            constant(TruthValue.YES_NO_NULL)), leaf(1))).toOldString());
    assertEquals("(and leaf-100)", SearchArgumentImpl.BuilderImpl.foldMaybe(
        SearchArgumentImpl.BuilderImpl.convertToCNF(and(leaf(100),
            or(and(leaf(0), leaf(1)),
                and(leaf(2), leaf(3)),
                and(leaf(4), leaf(5)),
                and(leaf(6), leaf(7)),
                and(leaf(8), leaf(9)),
                and(leaf(10), leaf(11)),
                and(leaf(12), leaf(13)),
                and(leaf(14), leaf(15)),
                and(leaf(16), leaf(17)))))).toOldString());
  }
Create a predicate leaf. This is used by another test.
ql/src/test/org/apache/hadoop/hive/ql/io/sarg/TestSearchArgumentImpl.java