use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestELSupport method testCoercetoFunctionalInterface02.
@Test
public void testCoercetoFunctionalInterface02() throws Exception {
final ELProcessor elp = new ELProcessor();
elp.defineFunction("", "", "org.apache.el.lang.TestELSupport", "testPredicateA");
Object result = elp.eval("testPredicateA(x -> !x.equals('data'))");
Assert.assertEquals("BLOCK", result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestELSupport method testCoercetoFunctionalInterface05.
@Test(expected = ELException.class)
public void testCoercetoFunctionalInterface05() throws Exception {
final ELProcessor elp = new ELProcessor();
elp.defineFunction("", "", "org.apache.el.lang.TestELSupport", "testPredicateC");
elp.eval("testPredicateC(x -> x > 50)");
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestELSupport method testCoercetoFunctionalInterface06.
@Test
public void testCoercetoFunctionalInterface06() throws Exception {
final ELProcessor elp = new ELProcessor();
elp.defineFunction("", "", "org.apache.el.lang.TestELSupport", "testBiPredicateA");
Object result = elp.eval("testBiPredicateA((x,y) -> x.name().equals('VALA1') && y)");
Assert.assertEquals("PASS", result);
}
use of jakarta.el.ELProcessor in project appslandia-common by haducloc.
the class CDIUtils method getELProcessor.
public static ELProcessor getELProcessor(BeanManager beanManager) {
ELProcessor elProcessor = new ELProcessor();
elProcessor.getELManager().addELResolver(beanManager.getELResolver());
return elProcessor;
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestMethodExpressionImpl method doTestVarArgsBeanG.
private void doTestVarArgsBeanG(String expression, Function<TesterBeanG, String> func) {
ELProcessor elp = new ELProcessor();
elp.defineBean("apple", TesterEnum.APPLE);
elp.defineBean("beanG", new TesterBeanG());
String elResult = elp.eval(expression);
String javaResult = func.apply(new TesterBeanG());
Assert.assertEquals(javaResult, elResult);
}
Aggregations