Package javax.el

Examples of javax.el.ELProcessor


    }


    @Test
    public void testLambdaAsFunction01() {
        ELProcessor processor = new ELProcessor();
        Object result =
                processor.getValue("v = (x->y->x-y); v(2)(1)",
                        Integer.class);
        Assert.assertEquals(Integer.valueOf(1), result);
    }
View Full Code Here


    }


    @Test
    public void testLambdaAsFunction02() {
        ELProcessor processor = new ELProcessor();
        Object result =
                processor.getValue("v = (()->y->2-y); v()(1)",
                        Integer.class);
        Assert.assertEquals(Integer.valueOf(1), result);
    }
View Full Code Here

    }


    @Test
    public void testLambdaAsFunction03() {
        ELProcessor processor = new ELProcessor();
        Object result =
                processor.getValue("v = (()->y->()->2-y); v()(1)()",
                        Integer.class);
        Assert.assertEquals(Integer.valueOf(1), result);
    }
View Full Code Here

    }


    @Test(expected=ELException.class)
    public void testLambdaAsFunction04() {
        ELProcessor processor = new ELProcessor();
        // More method parameters than there are nested lambda expressions
        processor.getValue("v = (()->y->()->2-y); v()(1)()()",
                    Integer.class);
    }
View Full Code Here

    }


    @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);
    }
View Full Code Here

    }


    @Test
    public void testLambdaAsFunction06() {
        ELProcessor processor = new ELProcessor();
        Object result =
                processor.getValue("v = (()->y->()->()->x->x-y); v()(1)()()(2)",
                        Integer.class);
        Assert.assertEquals(Integer.valueOf(1), result);
    }
View Full Code Here

    }


    @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);
    }
View Full Code Here

    }


    @Test
    public void testSubstreamStartEnd01() {
        ELProcessor processor = new ELProcessor();
        processor.defineBean("beans", beans);

        Object result = processor.getValue(
                "beans.stream().substream(1,2).toList()",
                Object.class);

        List<TesterBeanA> expected = new ArrayList<>(2);
        expected.add(bean02);
View Full Code Here

    }


    @Test
    public void testToArray01() {
        ELProcessor processor = new ELProcessor();
        processor.defineBean("beans", beans);

        Object result = processor.getValue(
                "beans.stream().toArray()",
                Object.class);

        Object[] expected = new Object[3];
        expected[0] = bean01;
View Full Code Here

    }


    @Test
    public void testReduceLambda01() {
        ELProcessor processor = new ELProcessor();

        Object result = processor.getValue(
                "[1,2,3,4,5].stream().reduce((x,y)->x+y)",
                Object.class);

        Assert.assertEquals(Long.valueOf(15), ((Optional) result).get());
    }
View Full Code Here

TOP

Related Classes of javax.el.ELProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.