예제 #1
0
 @Test
 public void testOrWithCriteria() {
   Criteria criteria = new Criteria("field_1").startsWith("start");
   Criteria orCriteria = new Criteria("field_2").endsWith("end").startsWith("start2");
   criteria = criteria.or(orCriteria);
   Assert.assertEquals(" OR ", criteria.getConjunctionOperator());
   Assert.assertEquals(2, criteria.getCriteriaChain().size());
 }
예제 #2
0
 @Test
 public void testAnd() {
   Criteria criteria =
       new Criteria("field_1")
           .startsWith("start")
           .endsWith("end")
           .and("field_2")
           .startsWith("2start")
           .endsWith("2end");
   Assert.assertEquals("field_2", criteria.getField().getName());
   Assert.assertEquals(" AND ", criteria.getConjunctionOperator());
   Assert.assertEquals(2, criteria.getCriteriaChain().size());
 }