Search in sources :

Example 1 with ASTLocate

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

the class FunctionExpressionFactoryTest method locateExp.

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

Aggregations

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