Search in sources :

Example 46 with ELProcessor

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

the class TestAstMapData method testNested01.

@Test
public void testNested01() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("{'simple':{'a':'1','b':'2','c':'3'}," + "'empty':{}," + "'d':'4'}", Map.class);
    Assert.assertEquals(nestedMap, result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 47 with ELProcessor

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

the class TestAstMapData method testSimple02.

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

Example 48 with ELProcessor

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

the class TestAstMapData 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':'1','b':'2','c':'3'}}", Map.class);
    Assert.assertEquals(Map.class, ve.getType(context));
    Assert.assertEquals(simpleMap, 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 49 with ELProcessor

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

the class TestAstMapData method testSimple01.

@Test
public void testSimple01() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("{'a':'1','b':'2','c':'3'}", Map.class);
    Assert.assertEquals(simpleMap, result);
}
Also used : ELProcessor(jakarta.el.ELProcessor) Test(org.junit.Test)

Example 50 with ELProcessor

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

the class TestAstSetData method testSimple02.

@Test
public void testSimple02() {
    ELProcessor processor = new ELProcessor();
    Object result = processor.getValue("{}", Set.class);
    Assert.assertEquals(Collections.EMPTY_SET, 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