Package org.apache.velocity.tools.generic

Examples of org.apache.velocity.tools.generic.AlternatorTool


    context.put("list", new ListTool());
    context.put("number", new NumberTool());
    context.put("render", new RenderTool());
    context.put("sorter", new SortTool());
    context.put("math", new MathTool());
    context.put("alternator", new AlternatorTool());
    context.put("comparisonDate", new ComparisonDateTool());
    context.put("iterator", new IteratorTool());
    context.put("parser", new ValueParser());
  }
View Full Code Here


        manager.configure(TOOLBOX_PATH);
        toolbox = manager.createContext();
    }

    public @Test void testAlternatorTool() {
        AlternatorTool alternatorTool = (AlternatorTool)toolbox.get("alternator");
        assertNotNull(alternatorTool);
        /* test automatic alternator */
        Alternator auto = alternatorTool.auto(new String[] {"red","blue","yellow"});
        assertStringEquals("red", auto.getCurrent());
        assertStringEquals("red", auto.getNext());
        assertStringEquals("blue", auto);
        assertStringEquals("yellow", auto);
        assertStringEquals("red", auto);
        /* test manual alternator (use 'make()' and not 'manual()' since we define the default to be manual in toolbox.xml*/
         Alternator manual = alternatorTool.make(new String[] {"red","blue","yellow"});
        assertStringEquals("red", manual);
        assertStringEquals("red", manual);
        manual.shift();
        assertStringEquals("blue", manual);
        manual.shift();
View Full Code Here

        manager.load(TOOLBOX_PATH);
        toolbox = manager.getToolbox(null);
    }

    public @Test void testAlternatorTool() {
        AlternatorTool alternatorTool = (AlternatorTool)toolbox.get("alternator");
        assertNotNull(alternatorTool);
        /* test automatic alternator */
        Alternator auto = alternatorTool.auto(new String[] {"red","blue","yellow"});
        assertEquals("red",auto.getCurrent());
        assertEquals("red",auto.getNext());
        assertEquals("blue",auto.toString());
        assertEquals("yellow",auto.toString());
        assertEquals("red",auto.toString());
        /* test manual alternator (use 'make()' and not 'manual()' since we define the default to be manual in toolbox.xml*/
         Alternator manual = alternatorTool.make(new String[] {"red","blue","yellow"});
        assertEquals("red",manual.toString());
        assertEquals("red",manual.toString());
        manual.shift();
        assertEquals("blue",manual.toString());
        manual.shift();
View Full Code Here

        manager.load(TOOLBOX_PATH);
        toolbox = manager.getToolbox(null);
    }

    public @Test void testAlternatorTool() {
        AlternatorTool alternatorTool = (AlternatorTool)toolbox.get("alternator");
        assertNotNull(alternatorTool);
        /* test automatic alternator */
        Alternator auto = alternatorTool.auto(new String[] {"red","blue","yellow"});
        assertStringEquals("red", auto.getCurrent());
        assertStringEquals("red", auto.getNext());
        assertStringEquals("blue", auto);
        assertStringEquals("yellow", auto);
        assertStringEquals("red", auto);
        /* test manual alternator (use 'make()' and not 'manual()' since we define the default to be manual in toolbox.xml*/
         Alternator manual = alternatorTool.make(new String[] {"red","blue","yellow"});
        assertStringEquals("red", manual);
        assertStringEquals("red", manual);
        manual.shift();
        assertStringEquals("blue", manual);
        manual.shift();
View Full Code Here

TOP

Related Classes of org.apache.velocity.tools.generic.AlternatorTool

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.