SearchArgumentImpl sarg =
(SearchArgumentImpl) SearchArgumentFactory.create(getFuncDesc(exprStr));
List<PredicateLeaf> leaves = sarg.getLeaves();
assertEquals(9, leaves.size());
PredicateLeaf leaf = leaves.get(0);
assertEquals(PredicateLeaf.Type.STRING, leaf.getType());
assertEquals(PredicateLeaf.Operator.EQUALS, leaf.getOperator());
assertEquals("first_name", leaf.getColumnName());
assertEquals("john", leaf.getLiteral());
leaf = leaves.get(1);
assertEquals(PredicateLeaf.Type.STRING, leaf.getType());
assertEquals(PredicateLeaf.Operator.LESS_THAN_EQUALS, leaf.getOperator());
assertEquals("first_name", leaf.getColumnName());
assertEquals("greg", leaf.getLiteral());
leaf = leaves.get(2);
assertEquals(PredicateLeaf.Type.STRING, leaf.getType());
assertEquals(PredicateLeaf.Operator.LESS_THAN, leaf.getOperator());
assertEquals("first_name", leaf.getColumnName());
assertEquals("alan", leaf.getLiteral());
leaf = leaves.get(3);
assertEquals(PredicateLeaf.Type.INTEGER, leaf.getType());
assertEquals(PredicateLeaf.Operator.LESS_THAN_EQUALS, leaf.getOperator());
assertEquals("id", leaf.getColumnName());
assertEquals(12L, leaf.getLiteral());
leaf = leaves.get(4);
assertEquals(PredicateLeaf.Type.INTEGER, leaf.getType());
assertEquals(PredicateLeaf.Operator.LESS_THAN_EQUALS, leaf.getOperator());
assertEquals("id", leaf.getColumnName());
assertEquals(13L, leaf.getLiteral());
leaf = leaves.get(5);
assertEquals(PredicateLeaf.Type.INTEGER, leaf.getType());
assertEquals(PredicateLeaf.Operator.LESS_THAN, leaf.getOperator());
assertEquals("id", leaf.getColumnName());
assertEquals(15L, leaf.getLiteral());
leaf = leaves.get(6);
assertEquals(PredicateLeaf.Type.INTEGER, leaf.getType());
assertEquals(PredicateLeaf.Operator.LESS_THAN, leaf.getOperator());
assertEquals("id", leaf.getColumnName());
assertEquals(16L, leaf.getLiteral());
leaf = leaves.get(7);
assertEquals(PredicateLeaf.Type.INTEGER, leaf.getType());
assertEquals(PredicateLeaf.Operator.NULL_SAFE_EQUALS, leaf.getOperator());
assertEquals("id", leaf.getColumnName());
assertEquals(30L, leaf.getLiteral());
leaf = leaves.get(8);
assertEquals(PredicateLeaf.Type.STRING, leaf.getType());
assertEquals(PredicateLeaf.Operator.NULL_SAFE_EQUALS, leaf.getOperator());
assertEquals("first_name", leaf.getColumnName());
assertEquals("owen", leaf.getLiteral());
assertEquals("(and (or leaf-0 (not leaf-1) leaf-2 (not leaf-3)" +
" (not leaf-4) leaf-5 leaf-6 leaf-7)" +
" (or leaf-0 (not leaf-1) leaf-2 (not leaf-3)" +
" (not leaf-4) leaf-5 leaf-6 leaf-8))",