private void testLogicFilter(Class<?> filterType) throws Exception {
BinaryLogicOperator complexLogicFilter;
PropertyIsGreaterThan resultFilter = ff.greater(ff.property("measurement/result"), ff
.literal(new Integer(5)));
PropertyIsBetween determFilter = ff.between(ff
.property("measurement/determinand_description"), ff
.literal("determinand_description_1_1"), ff.literal("determinand_description_3_3"));
if (And.class.equals(filterType)) {
complexLogicFilter = ff.and(resultFilter, determFilter);
} else if (Or.class.equals(filterType)) {
complexLogicFilter = ff.or(resultFilter, determFilter);
} else {
throw new IllegalArgumentException();
}
Filter unmapped = (Filter) complexLogicFilter.accept(visitor, null);
assertNotNull(unmapped);
assertTrue(unmapped instanceof BinaryLogicOperator);
assertNotSame(complexLogicFilter, unmapped);
BinaryLogicOperator logicUnmapped = (BinaryLogicOperator) unmapped;
List children = logicUnmapped.getChildren();
assertEquals(2, children.size());
PropertyIsGreaterThan unmappedResult = (PropertyIsGreaterThan) children.get(0);
PropertyIsBetween unmappedDeterm = (PropertyIsBetween) children.get(1);
assertEquals("results_value", ((PropertyName) unmappedResult.getExpression1())
.getPropertyName());
assertEquals(new Integer(5), ((Literal) unmappedResult.getExpression2()).getValue());
assertEquals("determinand_description", ((PropertyName) unmappedDeterm.getExpression())
.getPropertyName());
assertEquals("determinand_description_1_1", ((Literal) unmappedDeterm.getLowerBoundary())
.getValue());
assertEquals("determinand_description_3_3", ((Literal) unmappedDeterm.getUpperBoundary())
.getValue());
}