Package org.stringtemplate.v4

Examples of org.stringtemplate.v4.ST.render()


        ST e = new ST(
                "<first(rest(names))>" // gets 2nd element
            );
        e.add("names", new int[] { 0, 1, 2 });
        String expecting = "1";
        assertEquals(expecting, e.render());
    }

    @Test public void testFirstWithOneAttributeOp() throws Exception {
        org.stringtemplate.v4.ST e = new org.stringtemplate.v4.ST(
                "<first(names)>"
View Full Code Here


        org.stringtemplate.v4.ST e = new ST(
                "<last(names)>"
            );
        e.add("names", new ArrayList<String>() {{add("Ter");}});
        String expecting = "Ter";
        assertEquals(expecting, e.render());
    }

    @Test public void testLastWithLengthOneArrayAttributeOp() throws Exception {
        ST e = new ST(
                "<last(names)>"
View Full Code Here

        ST e = new ST(
                "<last(names)>"
            );
        e.add("names", new String[] { "Ter" });
        String expecting = "Ter";
        assertEquals(expecting, e.render());
    }

    @Test public void testLastWithLengthOnePrimitiveArrayAttributeOp() throws Exception {
        ST e = new ST(
                "<last(names)>"
View Full Code Here

        ST e = new ST(
                "<last(names)>"
            );
        e.add("names", new int[] { 0 });
        String expecting = "0";
        assertEquals(expecting, e.render());
    }

    @Test public void testRestWithOneAttributeOp() throws Exception {
        org.stringtemplate.v4.ST e = new org.stringtemplate.v4.ST(
                "<rest(names)>"
View Full Code Here

        ST e = new ST(
                "<rest(names)>"
            );
        e.add("names", new String[] { "Ter" });
        String expecting = "";
        assertEquals(expecting, e.render());
    }

    @Test public void testRestWithLengthOnePrimitiveArrayAttributeOp() throws Exception {
        ST e = new ST(
                "<rest(names)>"
View Full Code Here

        ST e = new ST(
                "<rest(names)>"
            );
        e.add("names", new int[] { 0 });
        String expecting = "";
        assertEquals(expecting, e.render());
    }

    @Test public void testRepeatedRestOp() throws Exception {
        org.stringtemplate.v4.ST e = new org.stringtemplate.v4.ST(
                "<rest(names)>, <rest(names)>" // gets 2nd element
View Full Code Here

        ST e = new ST(
                "<rest(names)>, <rest(names)>" // gets 2nd element
            );
        e.add("names", Arrays.asList("Ter", "Tom"));
        String expecting = "Tom, Tom";
        assertEquals(expecting, e.render());
    }

    @Test public void testRepeatedRestOpArray() throws Exception {
        ST e = new ST(
                "<rest(names)>, <rest(names)>" // gets 2nd element
View Full Code Here

        ST e = new ST(
                "<rest(names)>, <rest(names)>" // gets 2nd element
            );
        e.add("names", new String[] { "Ter", "Tom" });
        String expecting = "Tom, Tom";
        assertEquals(expecting, e.render());
    }

    @Test public void testRepeatedRestOpPrimitiveArray() throws Exception {
        ST e = new ST(
                "<rest(names)>, <rest(names)>" // gets 2nd element
View Full Code Here

        ST e = new ST(
                "<rest(names)>, <rest(names)>" // gets 2nd element
            );
        e.add("names", new int[] { 0, 1 });
        String expecting = "1, 1";
        assertEquals(expecting, e.render());
    }

    @Test public void testIncomingLists() throws Exception {
        ST e = new org.stringtemplate.v4.ST(
                "<rest(names)>, <rest(names)>" // gets 2nd element
View Full Code Here

                "<rest(names)>, <rest(names)>" // gets 2nd element
            );
        e.add("names", "Ter");
        e.add("names", "Tom");
        String expecting = "Tom, Tom";
        assertEquals(expecting, e.render());
    }

  @Test public void testFirstWithCatAttribute() throws Exception {
    ST e = new org.stringtemplate.v4.ST(
        "<first([names,phones])>"
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.