Search in sources :

Example 1 with ASTMod

use of org.apache.cayenne.exp.parser.ASTMod in project cayenne by apache.

the class FunctionExpressionFactoryTest method modExp.

@Test
public void modExp() throws Exception {
    Expression exp1 = FunctionExpressionFactory.modExp(Artist.ARTIST_NAME.path(), 10);
    Expression exp2 = FunctionExpressionFactory.modExp(Artist.ARTIST_NAME.getName(), 10);
    Expression exp3 = FunctionExpressionFactory.modExp(Artist.ARTIST_NAME.path(), new ASTScalar(10));
    assertTrue(exp1 instanceof ASTMod);
    assertEquals(2, exp1.getOperandCount());
    assertEquals(Artist.ARTIST_NAME.path(), exp1.getOperand(0));
    assertEquals(10, exp1.getOperand(1));
    assertEquals(exp1, exp2);
    assertEquals(exp2, exp3);
}
Also used : ASTMod(org.apache.cayenne.exp.parser.ASTMod) ASTScalar(org.apache.cayenne.exp.parser.ASTScalar) Test(org.junit.Test)

Aggregations

ASTMod (org.apache.cayenne.exp.parser.ASTMod)1 ASTScalar (org.apache.cayenne.exp.parser.ASTScalar)1 Test (org.junit.Test)1