}
public void testAndExpression() throws ExpressionEvaluationException {
log.debug("Testing AndExpression");
try {
new AndExpression().evaluate(this.resolver);
fail("AndExpression must throw an exception");
} catch (ExpressionEvaluationException e) {
// normal
}
try {
new AndExpression().add(this.trueExpr).evaluate(this.resolver);
} catch (ExpressionEvaluationException e) {
fail("AndExpression must pass with one child");
}
try {
new AndExpression().add(this.notBoolExpr).add(this.trueExpr).add(
this.trueExpr).evaluate(this.resolver);
fail("AndExpression must throw an exception");
} catch (Exception e) {
// normal
}
assertEquals("AndExpression must return true", Boolean.TRUE,
new AndExpression().add(this.trueExpr).add(this.trueExpr)
.evaluate(this.resolver));
assertEquals("AndExpression must return false", Boolean.FALSE,
new AndExpression().add(this.falseExpr).add(this.trueExpr)
.evaluate(this.resolver));
assertEquals("AndExpression must return false", Boolean.FALSE,
new AndExpression().add(this.trueExpr).add(this.falseExpr)
.evaluate(this.resolver));
assertEquals("AndExpression must return false", Boolean.FALSE,
new AndExpression().add(this.falseExpr).add(this.falseExpr)
.evaluate(this.resolver));
}