Package org.stringtemplate.v4

Examples of org.stringtemplate.v4.STGroup.defineTemplate()


}

  @Test public void testRepeatedMapWithNullValue() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("a", "x", "[<x>]");
    group.defineTemplate("b", "x", "(<x>)");
    group.defineTemplate("test", "name", "hi <name:a():b()>!");
    ST st = group.getInstanceOf("test");
    st.add("name", "Ter");
    st.add("name", null);
    st.add("name", "Sumana");
View Full Code Here


  @Test public void testRepeatedMapWithNullValue() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("a", "x", "[<x>]");
    group.defineTemplate("b", "x", "(<x>)");
    group.defineTemplate("test", "name", "hi <name:a():b()>!");
    ST st = group.getInstanceOf("test");
    st.add("name", "Ter");
    st.add("name", null);
    st.add("name", "Sumana");
    String expected =
View Full Code Here

    assertEquals(expected, result);
  }

  @Test public void testRepeatedMapWithNullValueAndNullOption() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("a", "x", "[<x>]");
    group.defineTemplate("b", "x", "(<x>)");
    group.defineTemplate("test", "name", "hi <name:a():b(); null={x}>!");
    ST st = group.getInstanceOf("test");
    st.add("name", "Ter");
    st.add("name", null);
View Full Code Here

  }

  @Test public void testRepeatedMapWithNullValueAndNullOption() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("a", "x", "[<x>]");
    group.defineTemplate("b", "x", "(<x>)");
    group.defineTemplate("test", "name", "hi <name:a():b(); null={x}>!");
    ST st = group.getInstanceOf("test");
    st.add("name", "Ter");
    st.add("name", null);
    st.add("name", "Sumana");
View Full Code Here

  @Test public void testRepeatedMapWithNullValueAndNullOption() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("a", "x", "[<x>]");
    group.defineTemplate("b", "x", "(<x>)");
    group.defineTemplate("test", "name", "hi <name:a():b(); null={x}>!");
    ST st = group.getInstanceOf("test");
    st.add("name", "Ter");
    st.add("name", null);
    st.add("name", "Sumana");
    String expected =
View Full Code Here

    assertEquals(expected, result);
  }

  @Test public void testRoundRobinMap() throws Exception {
        STGroup group = new STGroup();
        group.defineTemplate("a", "x", "[<x>]");
        group.defineTemplate("b", "x", "(<x>)");
        group.defineTemplate("test", "name", "hi <name:a(),b()>!");
        ST st = group.getInstanceOf("test");
        st.add("name", "Ter");
        st.add("name", "Tom");
View Full Code Here

  }

  @Test public void testRoundRobinMap() throws Exception {
        STGroup group = new STGroup();
        group.defineTemplate("a", "x", "[<x>]");
        group.defineTemplate("b", "x", "(<x>)");
        group.defineTemplate("test", "name", "hi <name:a(),b()>!");
        ST st = group.getInstanceOf("test");
        st.add("name", "Ter");
        st.add("name", "Tom");
        st.add("name", "Sumana");
View Full Code Here

  @Test public void testRoundRobinMap() throws Exception {
        STGroup group = new STGroup();
        group.defineTemplate("a", "x", "[<x>]");
        group.defineTemplate("b", "x", "(<x>)");
        group.defineTemplate("test", "name", "hi <name:a(),b()>!");
        ST st = group.getInstanceOf("test");
        st.add("name", "Ter");
        st.add("name", "Tom");
        st.add("name", "Sumana");
        String expected =
View Full Code Here

        assertEquals(expected, result);
    }

  @Test public void testSeparator() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("test", "names", "<names:{n | case <n>}; separator=\", \">");
    ST st = group.getInstanceOf("test");
    st.add("names", "Ter");
    st.add("names", "Tom");
    String expected =
      "case Ter, case Tom";
View Full Code Here

    assertEquals(expected, result);
  }

  @Test public void testSeparatorInList() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("test", "names", "<names:{n | case <n>}; separator=\", \">");
    ST st = group.getInstanceOf("test");
    st.add("names", new ArrayList<String>() {{
      add("Ter");
      add("Tom");
    }});
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.