use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestCollectionOperations method testSorted01.
@Test
public void testSorted01() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("['c', 'd', 'b', 'a'].stream().sorted().toList()", List.class);
List<String> expected = new ArrayList<>(4);
expected.add("a");
expected.add("b");
expected.add("c");
expected.add("d");
Assert.assertEquals(expected, result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestCollectionOperations method testAverage03.
@Test(expected = ELException.class)
public void testAverage03() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("[].stream().average()", Object.class);
((Optional) result).get();
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestMethodExpressionImpl method testPreferNoVarArgs.
@Test
public void testPreferNoVarArgs() {
ELProcessor elp = new ELProcessor();
TesterBeanAAA bean = new TesterBeanAAA();
bean.setName("xyz");
elp.defineBean("bean2", bean);
elp.defineBean("bean1", new TesterBeanI());
String elResult = elp.eval("bean1.echo(bean2)");
Assert.assertEquals("No varargs: xyz", elResult);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstNot method test03.
@Test
public void test03() {
ELProcessor processor = new ELProcessor();
Boolean result = processor.eval("!false");
Assert.assertEquals(Boolean.TRUE, result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestAstSemicolon method testGetValue02.
@Test
public void testGetValue02() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("1;2", Integer.class);
Assert.assertEquals(Integer.valueOf(2), result);
}
Aggregations