use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTFunctionCallMathIT method testASTModParse.
@Test
public void testASTModParse() {
Expression exp = ExpressionFactory.exp("mod(11,2)");
assertEquals(1.0, exp.evaluate(new Object()));
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTFunctionCallMathIT method testASTAbsParse.
@Test
public void testASTAbsParse() {
Expression exp = ExpressionFactory.exp("abs(-3)");
assertEquals(3.0, exp.evaluate(new Object()));
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTFunctionCallStringIT method testASTUpperParse.
@Test
public void testASTUpperParse() {
Expression exp = ExpressionFactory.exp("upper('aBc')");
assertEquals("ABC", exp.evaluate(new Object()));
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTFunctionCallStringIT method testASTLowerParse.
@Test
public void testASTLowerParse() {
Expression exp = ExpressionFactory.exp("lower('AbC')");
assertEquals("abc", exp.evaluate(new Object()));
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTFunctionCallStringIT method testComplexParse.
@Test
public void testComplexParse() {
Expression exp = ExpressionFactory.exp("locate(upper('Bc'), upper('aBc')) = length(substring(trim(lower(concat(' abc', 'def '))), 3, 2))");
assertEquals(true, exp.evaluate(new Object()));
}
Aggregations