Search in sources :

Example 56 with ELProcessor

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

the class TestAstListData method testGetType.

@Test
public void testGetType() {
    ELProcessor processor = new ELProcessor();
    ELContext context = processor.getELManager().getELContext();
    ExpressionFactory factory = ELManager.getExpressionFactory();
    ValueExpression ve = factory.createValueExpression(context, "${['a','b','c','b','c']}", List.class);
    Assert.assertEquals(List.class, ve.getType(context));
    Assert.assertEquals(simpleList, ve.getValue(context));
}
Also used : ELContext(jakarta.el.ELContext) ExpressionFactory(jakarta.el.ExpressionFactory) ValueExpression(jakarta.el.ValueExpression) ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 57 with ELProcessor

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

the class TestAstListData method testNested01.

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

Example 58 with ELProcessor

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

the class TestAstAnd method test03.

@Test
public void test03() {
    ELProcessor processor = new ELProcessor();
    Boolean result = processor.eval("null && true");
    Assert.assertEquals(Boolean.FALSE, result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 59 with ELProcessor

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

the class TestAstAnd method test01.

@Test
public void test01() {
    ELProcessor processor = new ELProcessor();
    Boolean result = processor.eval("true && true");
    Assert.assertEquals(Boolean.TRUE, result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 60 with ELProcessor

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

the class TestAstLambdaExpression method testSpec03.

@Test
public void testSpec03() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("(()->64)", Integer.class);
    Assert.assertEquals(Integer.valueOf(64), 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