use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestCollectionOperations method testSortedLambdaExpression01.
@Test
public void testSortedLambdaExpression01() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("['c', 'd', 'b', 'a'].stream().sorted((x,y)->x.compareTo(y)*-1).toList()", List.class);
List<String> expected = new ArrayList<>(4);
expected.add("d");
expected.add("c");
expected.add("b");
expected.add("a");
Assert.assertEquals(expected, result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestCollectionOperations method testFilter01.
@Test
public void testFilter01() {
ELProcessor processor = new ELProcessor();
processor.defineBean("beans", beans);
Object result = processor.getValue("beans.stream().filter(b->b.valLong > 2).toList()", List.class);
List<TesterBeanA> expected = new ArrayList<>(1);
expected.add(bean03);
Assert.assertEquals(expected, result);
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestCollectionOperations method testNoneMatch01.
@Test
public void testNoneMatch01() {
ELProcessor processor = new ELProcessor();
Optional result = (Optional) processor.getValue("[1,2,3,4,5].stream().allMatch(x->x>3)", Object.class);
Assert.assertEquals(Boolean.FALSE, result.get());
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestCollectionOperations method testMax01.
@Test
public void testMax01() {
ELProcessor processor = new ELProcessor();
Object result = processor.getValue("[1,2,3,4,5].stream().max()", Object.class);
Assert.assertEquals(Long.valueOf(5), ((Optional) result).get());
}
use of jakarta.el.ELProcessor in project tomcat by apache.
the class TestCollectionOperations method testSubstreamStart01.
@Test
public void testSubstreamStart01() {
ELProcessor processor = new ELProcessor();
processor.defineBean("beans", beans);
Object result = processor.getValue("beans.stream().substream(1).toList()", Object.class);
List<TesterBeanA> expected = new ArrayList<>(2);
expected.add(bean02);
expected.add(bean03);
Assert.assertEquals(expected, result);
}
Aggregations