Search in sources :

Example 81 with ELProcessor

use of jakarta.el.ELProcessor in project tomcat by apache.

the class TestAstConcatenation method testPrecedence02.

/**
 * Test operator precedence (+ before +=).
 */
@Test
public void testPrecedence02() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("1 += 2 + 3", String.class);
    Assert.assertEquals("15", result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 82 with ELProcessor

use of jakarta.el.ELProcessor in project tomcat by apache.

the class TestAstConcatenation method testConcatenation03.

/**
 * Test string concatenation with whitespace.
 */
@Test
public void testConcatenation03() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("' a' += ' b '", String.class);
    Assert.assertEquals(" a b ", result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 83 with ELProcessor

use of jakarta.el.ELProcessor in project tomcat by apache.

the class TestAstConcatenation method testPrecedence04.

/**
 * Test operator precedence (+= before >).
 */
@Test
public void testPrecedence04() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("1 += 2 > 3", String.class);
    Assert.assertEquals("true", result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 84 with ELProcessor

use of jakarta.el.ELProcessor in project tomcat by apache.

the class TestAstIdentifier method testImport01.

@Test
public void testImport01() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("Integer.MAX_VALUE", Integer.class);
    Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE), result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 85 with ELProcessor

use of jakarta.el.ELProcessor in project tomcat by apache.

the class TestAstIdentifier method testImport02.

@Test
public void testImport02() {
    ELProcessor processor = new ELProcessor();
    processor.getELManager().getELContext().getImportHandler().importStatic("java.lang.Integer.MAX_VALUE");
    Object result = processor.getValue("MAX_VALUE", Integer.class);
    Assert.assertEquals(Integer.valueOf(Integer.MAX_VALUE), result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Aggregations

ELProcessor (jakarta.el.ELProcessor)138 Test (org.junit.Test)133 ArrayList (java.util.ArrayList)13 ELContext (jakarta.el.ELContext)8 ValueExpression (jakarta.el.ValueExpression)8 ExpressionFactory (jakarta.el.ExpressionFactory)7 TesterBeanA (org.apache.el.TesterBeanA)5 List (java.util.List)1