Package javax.el

Examples of javax.el.ELProcessor


    }


    @Test(expected=ELException.class)
    public void testReduceLambda02() {
        ELProcessor processor = new ELProcessor();

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

        ((Optional) result).get();
    }
View Full Code Here


    }


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

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

        Assert.assertEquals(Long.valueOf(25), result);
    }
View Full Code Here

    }


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

    }


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

        Object result = processor.getValue(
                "[5,4,3,2,1].stream().max()",
                Object.class);

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

    }


    @Test(expected=ELException.class)
    public void testMax03() {
        ELProcessor processor = new ELProcessor();

        Object result = processor.getValue(
                "[].stream().max()",
                Object.class);

        ((Optional) result).get();
    }
View Full Code Here

    }


    @Test(expected=ELException.class)
    public void testMax04() {
        ELProcessor processor = new ELProcessor();
        processor.defineBean("beans", beans);

        processor.getValue(
                "beans.stream().max()",
                Object.class);
    }
View Full Code Here

    }


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

        Object result = processor.getValue(
                "beans.stream().max((x,y)->x.name.compareTo(y.name))",
                Object.class);

        Assert.assertEquals(bean03, ((Optional) result).get());
    }
View Full Code Here

    }


    @Test
    public void testMaxLambda02() {
        ELProcessor processor = new ELProcessor();
        processor.defineBean("beans", beans);
        processor.setVariable("comparison", "v->(x,y)->v(x).compareTo(v(y))");

        Object result = processor.getValue(
                "beans.stream().max(comparison(x->x.name))",
                Object.class);

        Assert.assertEquals(bean03, ((Optional) result).get());
    }
View Full Code Here

        Assert.assertEquals(bean03, ((Optional) result).get());
    }
    @Test
    public void testMin01() {
        ELProcessor processor = new ELProcessor();

        Object result = processor.getValue(
                "[1,2,3,4,5].stream().min()",
                Object.class);

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

    }


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

        Object result = processor.getValue(
                "[5,4,3,2,1].stream().min()",
                Object.class);

        Assert.assertEquals(Long.valueOf(1), ((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.