use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstSemicolon method testGetType.
@Test
public void testGetType() {
ELProcessor processor = new ELProcessor();
ELContext context = processor.getELManager().getELContext();
ExpressionFactory factory = ELManager.getExpressionFactory();
ValueExpression ve = factory.createValueExpression(context, "${1+1;2+2}", Integer.class);
Assert.assertEquals(Number.class, ve.getType(context));
Assert.assertEquals(Integer.valueOf(4), ve.getValue(context));
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstSemicolon method testGetValue03.
@Test
public void testGetValue03() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("1;2 + 3", Integer.class);
Assert.assertEquals(Integer.valueOf(5), result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestMethodExpressionImpl method doTestVarArgsBeanH.
private void doTestVarArgsBeanH(String expression, Function<TesterBeanH, String> func) {
ELProcessor elp = new ELProcessor();
elp.defineBean("apple", TesterEnum.APPLE);
elp.defineBean("beanH", new TesterBeanH());
String elResult = elp.eval(expression);
String javaResult = func.apply(new TesterBeanH());
Assert.assertEquals(javaResult, elResult);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstLambdaExpression method testNested02.
@Test
public void testNested02() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("(()->y->()->2-y)()(1)()", Integer.class);
Assert.assertEquals(Integer.valueOf(1), result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstLambdaExpression method testLambdaAsFunction07.
@Test
public void testLambdaAsFunction07() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("v = (()->y->()->()->x->x-y); v()(1)()(3)(2)", Integer.class);
Assert.assertEquals(Integer.valueOf(1), result);
}
Aggregations