use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstLambdaExpression method testNested04.
@Test
public void testNested04() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("(()->y->()->x->x-y)()(1)()(2)", Integer.class);
Assert.assertEquals(Integer.valueOf(1), result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstLambdaExpression method testNested07.
@Test
public void testNested07() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("()->()->()->42", Integer.class);
Assert.assertEquals(Integer.valueOf(42), result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstLambdaExpression method testNested03.
@Test(expected = ELException.class)
public void testNested03() {
ELProcessor processor = new ELProcessor();
// More method parameters than there are nested lambda expressions
processor.getValue("(()->y->()->2-y)()(1)()()", Integer.class);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstLambdaExpression method testLambdaAsFunction05.
@Test
public void testLambdaAsFunction05() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("v = (()->y->()->x->x-y); v()(1)()(2)", Integer.class);
Assert.assertEquals(Integer.valueOf(1), result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstLambdaExpression method testSpec05.
@Test
public void testSpec05() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("fact = n -> n==0? 1: n*fact(n-1); fact(5)", Integer.class);
Assert.assertEquals(Integer.valueOf(120), result);
}
Aggregations