public void testLikeExpression() throws ExpressionEvaluationException {
log.debug("Testing LikeExpression");
boolean ignoreCase = false;
try {
new LikeExpression(null, null, ignoreCase).evaluate(this.resolver);
fail("LikeExpression operands can not be nulls");
} catch (Exception e) {
// normal
}
try {
new LikeExpression(this.tom, null, ignoreCase)
.evaluate(this.resolver);
fail("LikeExpression operands can not be nulls");
} catch (Exception e) {
// normal
}
try {
new LikeExpression(null, this.om, ignoreCase)
.evaluate(this.resolver);
fail("LikeExpression operands can not be nulls");
} catch (Exception e) {
// normal
}
// evaluating
assertEquals("LikeExpression must return true", Boolean.TRUE,
new LikeExpression(this.tom, this.om, false)
.evaluate(this.resolver));
assertEquals("LikeExpression must return true", Boolean.TRUE,
new LikeExpression(this.tom, this.tm, true)
.evaluate(this.resolver));
assertEquals("LikeExpression must return false", Boolean.FALSE,
new LikeExpression(this.tom, this.tm, false)
.evaluate(this.resolver));
assertEquals("LikeExpression must return false", Boolean.FALSE,
new LikeExpression(this.jerry, this.om, false)
.evaluate(this.resolver));
}