use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstLambdaExpression method testSpec04.
@Test
public void testSpec04() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("v = (x,y)->x+y; v(3,4)", Integer.class);
Assert.assertEquals(Integer.valueOf(7), result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstLambdaExpression method testInvocation01.
@Test
public void testInvocation01() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("(()->2)()", Integer.class);
Assert.assertEquals(Integer.valueOf(2), result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstLambdaExpression method testNested06.
@Test
public void testNested06() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("(()->y->()->()->x->x-y)()(1)()(3)(2)", Integer.class);
Assert.assertEquals(Integer.valueOf(1), result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstLambdaExpression method testLambdaAsFunction02.
@Test
public void testLambdaAsFunction02() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("v = (()->y->2-y); v()(1)", Integer.class);
Assert.assertEquals(Integer.valueOf(1), result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstMapData method testLiteralWithVariable.
@Test
public void testLiteralWithVariable() {
ELProcessor elp = new ELProcessor();
String key = "myKey";
String value = "myValue";
elp.setVariable("aaa", "'" + key + "'");
elp.setVariable("bbb", "'" + value + "'");
Object result = elp.eval("{ aaa : bbb }.get(aaa)");
Assert.assertEquals(value, result);
}
Aggregations