Package org.apache.jasper.el

Examples of org.apache.jasper.el.ELContextImpl


     * Tests a coercion cannot be performed as the key is not integer.
     */
    @Test(expected = IllegalArgumentException.class)
    public void testGetValue04() {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        String[] base = new String[] { "element" };
        resolver.getValue(context, base, "key");
    }
View Full Code Here


     * Tests that the key is out of bounds and null will be returned.
     */
    @Test
    public void testGetValue05() {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        String[] base = new String[] { "element" };
        Object result = resolver.getValue(context, base, new Integer(1));

        Assert.assertNull(result);
        Assert.assertTrue(context.isPropertyResolved());

        result = resolver.getValue(context, base, new Integer(-1));

        Assert.assertNull(result);
        Assert.assertTrue(context.isPropertyResolved());
    }
View Full Code Here

     * Tests that an exception is thrown when readOnly is true.
     */
    @Test(expected = PropertyNotWritableException.class)
    public void testSetValue03() {
        ArrayELResolver resolver = new ArrayELResolver(true);
        ELContext context = new ELContextImpl();

        resolver.setValue(context, new String[] {}, new Object(), new Object());
    }
View Full Code Here

     * Tests that a valid property is set.
     */
    @Test
    public void testSetValue04() {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        String[] base = new String[] { "element" };
        resolver.setValue(context, base, new Integer(0), "new-element");

        Assert.assertEquals("new-element",
                resolver.getValue(context, base, new Integer(0)));
        Assert.assertTrue(context.isPropertyResolved());

        resolver.setValue(context, base, new Integer(0), null);

        Assert.assertEquals(null,
                resolver.getValue(context, base, new Integer(0)));
        Assert.assertTrue(context.isPropertyResolved());
    }
View Full Code Here

     * Tests a coercion cannot be performed as the key is not integer.
     */
    @Test(expected = IllegalArgumentException.class)
    public void testSetValue05() {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        String[] base = new String[] { "element" };
        resolver.setValue(context, base, "key", "new-element");
    }
View Full Code Here

     * Tests that the key is out of bounds and exception will be thrown.
     */
    @Test(expected = PropertyNotFoundException.class)
    public void testSetValue06() {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        String[] base = new String[] { "element" };
        resolver.setValue(context, base, new Integer(1), "new-element");
    }
View Full Code Here

     * corresponding type.
     */
    @Test(expected = ClassCastException.class)
    public void testSetValue07() {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        String[] base = new String[] { "element" };
        resolver.setValue(context, base, new Integer(0), new Integer(1));
    }
View Full Code Here

     * Tests that the propertyResolved is false if base is not an array.
     */
    @Test
    public void testIsReadOnly02() {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        boolean result = resolver.isReadOnly(context, new Object(),
                new Object());

        Assert.assertFalse(result);
        Assert.assertFalse(context.isPropertyResolved());

        resolver = new ArrayELResolver(true);

        result = resolver.isReadOnly(context, new Object(), new Object());

        Assert.assertTrue(result);
        Assert.assertFalse(context.isPropertyResolved());
    }
View Full Code Here

     * will return always true, otherwise false.
     */
    @Test
    public void testIsReadOnly03() {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        String[] base = new String[] { "element" };
        boolean result = resolver.isReadOnly(context, base, new Integer(0));

        Assert.assertFalse(result);
        Assert.assertTrue(context.isPropertyResolved());

        resolver = new ArrayELResolver(true);

        result = resolver.isReadOnly(context, base, new Integer(0));

        Assert.assertTrue(result);
        Assert.assertTrue(context.isPropertyResolved());
    }
View Full Code Here

     * Tests that the key is out of bounds and exception will be thrown.
     */
    @Test(expected = PropertyNotFoundException.class)
    public void testIsReadOnly04() {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        String[] base = new String[] { "element" };
        resolver.isReadOnly(context, base, new Integer(1));
    }
View Full Code Here

TOP

Related Classes of org.apache.jasper.el.ELContextImpl

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.