Package org.apache.velocity.tools.generic

Examples of org.apache.velocity.tools.generic.FieldTool$MutableField


    }

    public static String MUTABLE_FIELD = "foo";

    public @Test void testFieldTool() {
        FieldTool fieldTool = (FieldTool)toolbox.get("field");
        assertNotNull(fieldTool);

        // read a constant from the configured included Class
        assertEquals(Integer.MAX_VALUE, fieldTool.get("MAX_VALUE"));

        // read a constant from java.lang.Boolean and make sure it is the same
        assertSame(Boolean.TRUE, fieldTool.in("java.lang.Boolean").get("TRUE"));

        // tell it to read constants from a non-existant class
        // (which should return null)
        assertNull(fieldTool.in("no.such.Class"));

        // tell field tool to read constants from this instance's Class
        // (which should NOT return null)
        assertNotNull(fieldTool.in(this));
        assertEquals(MUTABLE_FIELD, fieldTool.get("MUTABLE_FIELD"));
        // grab the mutable field
        String foo = MUTABLE_FIELD;
        // change it
        MUTABLE_FIELD = MUTABLE_FIELD + MUTABLE_FIELD;
        // make sure it changed
        assertFalse(foo.equals(MUTABLE_FIELD));
        // make sure the fieldtool recognized that it changed
        assertEquals(MUTABLE_FIELD, fieldTool.get("MUTABLE_FIELD"));

        // pass a full field path to the get() method
        assertEquals(Long.MIN_VALUE, fieldTool.get("java.lang.Long.MIN_VALUE"));
    }
View Full Code Here


    }

    public static String MUTABLE_FIELD = "foo";

    public @Test void testFieldTool() {
        FieldTool fieldTool = (FieldTool)toolbox.get("field");
        assertNotNull(fieldTool);

        // read a constant from the configured included Class
        assertEquals(Integer.MAX_VALUE, fieldTool.get("MAX_VALUE"));

        // read a constant from java.lang.Boolean and make sure it is the same
        assertSame(Boolean.TRUE, fieldTool.in("java.lang.Boolean").get("TRUE"));

        // tell it to read constants from a non-existant class
        // (which should return null)
        assertNull(fieldTool.in("no.such.Class"));

        // tell field tool to read constants from this instance's Class
        // (which should NOT return null)
        assertNotNull(fieldTool.in(this));
        assertEquals(MUTABLE_FIELD, fieldTool.get("MUTABLE_FIELD"));
        // grab the mutable field
        String foo = MUTABLE_FIELD;
        // change it
        MUTABLE_FIELD = MUTABLE_FIELD + MUTABLE_FIELD;
        // make sure it changed
        assertFalse(foo.equals(MUTABLE_FIELD));
        // make sure the fieldtool recognized that it changed
        assertEquals(MUTABLE_FIELD, fieldTool.get("MUTABLE_FIELD"));

        // pass a full field path to the get() method
        assertEquals(Long.MIN_VALUE, fieldTool.get("java.lang.Long.MIN_VALUE"));
    }
View Full Code Here

    }

    public static String MUTABLE_FIELD = "foo";

    public @Test void testFieldTool() {
        FieldTool fieldTool = (FieldTool)toolbox.get("field");
        assertNotNull(fieldTool);

        // read a constant from the configured included Class
        assertEquals(Integer.MAX_VALUE, fieldTool.get("MAX_VALUE"));

        // read a constant from java.lang.Boolean and make sure it is the same
        assertSame(Boolean.TRUE, fieldTool.in("java.lang.Boolean").get("TRUE"));

        // tell it to read constants from a non-existant class
        // (which should return null)
        assertNull(fieldTool.in("no.such.Class"));

        // tell field tool to read constants from this instance's Class
        // (which should NOT return null)
        assertNotNull(fieldTool.in(this));
        assertEquals(MUTABLE_FIELD, fieldTool.get("MUTABLE_FIELD"));
        // grab the mutable field
        String foo = MUTABLE_FIELD;
        // change it
        MUTABLE_FIELD = MUTABLE_FIELD + MUTABLE_FIELD;
        // make sure it changed
        assertFalse(foo.equals(MUTABLE_FIELD));
        // make sure the fieldtool recognized that it changed
        assertEquals(MUTABLE_FIELD, fieldTool.get("MUTABLE_FIELD"));

        // pass a full field path to the get() method
        assertEquals(Long.MIN_VALUE, fieldTool.get("java.lang.Long.MIN_VALUE"));
    }
View Full Code Here

TOP

Related Classes of org.apache.velocity.tools.generic.FieldTool$MutableField

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.