Search in sources :

Example 6 with Addition

use of net.sf.jsqlparser.expression.operators.arithmetic.Addition in project JSqlParser by JSQLParser.

the class CCJSqlParserUtilTest method testParseExpression.

/**
 * Test of parseExpression method, of class CCJSqlParserUtil.
 */
@Test
public void testParseExpression() throws Exception {
    Expression result = CCJSqlParserUtil.parseExpression("a+b");
    assertEquals("a + b", result.toString());
    assertTrue(result instanceof Addition);
    Addition add = (Addition) result;
    assertTrue(add.getLeftExpression() instanceof Column);
    assertTrue(add.getRightExpression() instanceof Column);
}
Also used : Addition(net.sf.jsqlparser.expression.operators.arithmetic.Addition) Expression(net.sf.jsqlparser.expression.Expression) Column(net.sf.jsqlparser.schema.Column) Test(org.junit.Test)

Aggregations

Addition (net.sf.jsqlparser.expression.operators.arithmetic.Addition)6 Test (org.junit.Test)4 Select (net.sf.jsqlparser.statement.select.Select)3 StatementExecutionException (herddb.model.StatementExecutionException)2 Expression (net.sf.jsqlparser.expression.Expression)2 LongValue (net.sf.jsqlparser.expression.LongValue)2 Division (net.sf.jsqlparser.expression.operators.arithmetic.Division)2 Multiplication (net.sf.jsqlparser.expression.operators.arithmetic.Multiplication)2 Subtraction (net.sf.jsqlparser.expression.operators.arithmetic.Subtraction)2 AndExpression (net.sf.jsqlparser.expression.operators.conditional.AndExpression)2 OrExpression (net.sf.jsqlparser.expression.operators.conditional.OrExpression)2 EqualsTo (net.sf.jsqlparser.expression.operators.relational.EqualsTo)2 GreaterThan (net.sf.jsqlparser.expression.operators.relational.GreaterThan)2 GreaterThanEquals (net.sf.jsqlparser.expression.operators.relational.GreaterThanEquals)2 LikeExpression (net.sf.jsqlparser.expression.operators.relational.LikeExpression)2 MinorThan (net.sf.jsqlparser.expression.operators.relational.MinorThan)2 MinorThanEquals (net.sf.jsqlparser.expression.operators.relational.MinorThanEquals)2 NotEqualsTo (net.sf.jsqlparser.expression.operators.relational.NotEqualsTo)2 Column (net.sf.jsqlparser.schema.Column)2 CalcitePlanner (herddb.sql.CalcitePlanner)1