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