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);
}