Search in sources :

Example 1 with Operator

use of org.springframework.expression.spel.ast.Operator in project spring-framework by spring-projects.

the class OperatorTests method testOperatorNames.

@Test
public void testOperatorNames() throws Exception {
    Operator node = getOperatorNode((SpelExpression) parser.parseExpression("1==3"));
    assertEquals("==", node.getOperatorName());
    node = getOperatorNode((SpelExpression) parser.parseExpression("1!=3"));
    assertEquals("!=", node.getOperatorName());
    node = getOperatorNode((SpelExpression) parser.parseExpression("3/3"));
    assertEquals("/", node.getOperatorName());
    node = getOperatorNode((SpelExpression) parser.parseExpression("3+3"));
    assertEquals("+", node.getOperatorName());
    node = getOperatorNode((SpelExpression) parser.parseExpression("3-3"));
    assertEquals("-", node.getOperatorName());
    node = getOperatorNode((SpelExpression) parser.parseExpression("3<4"));
    assertEquals("<", node.getOperatorName());
    node = getOperatorNode((SpelExpression) parser.parseExpression("3<=4"));
    assertEquals("<=", node.getOperatorName());
    node = getOperatorNode((SpelExpression) parser.parseExpression("3*4"));
    assertEquals("*", node.getOperatorName());
    node = getOperatorNode((SpelExpression) parser.parseExpression("3%4"));
    assertEquals("%", node.getOperatorName());
    node = getOperatorNode((SpelExpression) parser.parseExpression("3>=4"));
    assertEquals(">=", node.getOperatorName());
    node = getOperatorNode((SpelExpression) parser.parseExpression("3 between 4"));
    assertEquals("between", node.getOperatorName());
    node = getOperatorNode((SpelExpression) parser.parseExpression("3 ^ 4"));
    assertEquals("^", node.getOperatorName());
}
Also used : Operator(org.springframework.expression.spel.ast.Operator) SpelExpression(org.springframework.expression.spel.standard.SpelExpression) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Operator (org.springframework.expression.spel.ast.Operator)1 SpelExpression (org.springframework.expression.spel.standard.SpelExpression)1