Search in sources :

Example 86 with ELProcessor

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

the class TestAstListData method testSimple02.

@Test
public void testSimple02() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("[]", List.class);
    Assert.assertEquals(Collections.EMPTY_LIST, result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 87 with ELProcessor

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

the class TestAstListData method testSimple01.

@Test
public void testSimple01() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("['a','b','c', 'b', 'c']", List.class);
    Assert.assertEquals(simpleList, result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 88 with ELProcessor

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

the class TestAstLambdaExpression method testSpec02.

@Test
public void testSpec02() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("((x,y)->x+y)(1,2)", Integer.class);
    Assert.assertEquals(Integer.valueOf(3), result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 89 with ELProcessor

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

the class TestAstLambdaExpression method testNested01.

@Test
public void testNested01() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("(()->y->2-y)()(1)", Integer.class);
    Assert.assertEquals(Integer.valueOf(1), result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 90 with ELProcessor

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

the class TestAstLambdaExpression method testLambdaAsFunction06.

@Test
public void testLambdaAsFunction06() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("v = (()->y->()->()->x->x-y); v()(1)()()(2)", Integer.class);
    Assert.assertEquals(Integer.valueOf(1), 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