@Test
public void testGenerateCriteria_MultipleOr() throws Exception {

    Map<String, String> mapCriteria = new HashMap<String, String>();
    mapCriteria.put("prop1", "a|b");
    mapCriteria.put("prop2", "c");
    mapCriteria.put("prop3", "d");
    QueryByCriteria.Builder qbcBuilder = generator.generateCriteria(TestClass.class, mapCriteria, false);
    assertNotNull("build should not have been null", qbcBuilder);
    QueryByCriteria qbc = qbcBuilder.build();
    // now walk the tree, it should come out as:
    // and(
    //   or(
    //     likeIgnoreCase(prop1, "a"),
    //     likeIgnoreCase(prop1, "b"),
    //   ),
    //   like(prop2, "c"),
    //   likeIgnoreCase(prop3, "d")
    // )
    Predicate and = qbc.getPredicate();
    assertTrue("top level predicate type incorrect.  Was: " + and, and instanceof AndPredicate);
    Set<Predicate> predicates = ((AndPredicate) and).getPredicates();
    assertEquals("Wrong number of top-level predicates", 3, predicates.size());
    boolean foundProp1 = false;
    boolean foundProp2 = false;
    boolean foundProp3 = false;
    for (Predicate predicate : predicates) {
        if (predicate instanceof LikePredicate) {
        	LikePredicate like = (LikePredicate)predicate;
            if (like.getPropertyPath().equals("prop2")) {
                assertEquals("prop2 had wrong value", "c", like.getValue().getValue());
                foundProp2 = true;
            } else {
                fail("Invalid like predicate encountered: " + predicate);
            }
        } else if (predicate instanceof LikeIgnoreCasePredicate) {
        	LikeIgnoreCasePredicate like = (LikeIgnoreCasePredicate)predicate;
            if (like.getPropertyPath().equals("prop3")) {
                assertEquals("prop3 had wrong value", "d", like.getValue().getValue());
                foundProp3 = true;
            } else {
                fail("Invalid likeIgnoreCase predicate encountered: " + predicate);
            }
        } else if (predicate instanceof OrPredicate) {
            foundProp1 = true;
            // under the or predicate we should have 2 likes, one for each component of the OR
            OrPredicate orPredicate = (OrPredicate)predicate;
            assertEquals("wrong number of predicates in the internal OR predicate",2, orPredicate.getPredicates().size());
            for (Predicate orSubPredicate : orPredicate.getPredicates()) {
                if (orSubPredicate instanceof LikeIgnoreCasePredicate) {
                    LikeIgnoreCasePredicate likeInternal = (LikeIgnoreCasePredicate)orSubPredicate;
                    if (likeInternal.getPropertyPath().equals("prop1")) {
                        assertTrue("prop1 had wrong value", "a".equals(likeInternal.getValue().getValue()) ||
                                "b".equals(likeInternal.getValue().getValue()));
                    } else {
                        fail("Invalid predicate, does not have a propertypath of prop1:" + predicate);
                    }
                } else {
                    fail("Unexpected predicate: " + orSubPredicate);
                }
            }
        } else {
            fail("Unexpected predicate: " + predicate);
        }
    }
    assertTrue("prop1 predicate missing", foundProp1);
    assertTrue("prop2 predicate missing", foundProp2);
    assertTrue("prop3 predicate missing", foundProp3);
}