use of org.apache.cayenne.exp.parser.ASTConcat in project cayenne by apache.
the class FunctionExpressionFactoryTest method concatExp.
@Test
public void concatExp() throws Exception {
Expression exp1 = FunctionExpressionFactory.concatExp(Artist.ARTIST_NAME.path(), new ASTScalar("abc"), Artist.DATE_OF_BIRTH.path());
assertTrue(exp1 instanceof ASTConcat);
assertEquals(3, exp1.getOperandCount());
assertEquals(Artist.ARTIST_NAME.path(), exp1.getOperand(0));
assertEquals("abc", exp1.getOperand(1));
assertEquals(Artist.DATE_OF_BIRTH.path(), exp1.getOperand(2));
Expression exp2 = FunctionExpressionFactory.concatExp(Artist.ARTIST_NAME.getName(), Artist.DATE_OF_BIRTH.getName(), Artist.PAINTING_ARRAY.getName());
assertTrue(exp2 instanceof ASTConcat);
assertEquals(3, exp2.getOperandCount());
assertEquals(Artist.ARTIST_NAME.path(), exp2.getOperand(0));
assertEquals(Artist.DATE_OF_BIRTH.path(), exp2.getOperand(1));
assertEquals(Artist.PAINTING_ARRAY.path(), exp2.getOperand(2));
}