Package net.sf.lapg.templates.api.impl

Examples of net.sf.lapg.templates.api.impl.DefaultStaticMethods


    h.put("list", new String[] { "a", "b" });
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(),
        new StringTemplateLoader("inline", "${template overrides.my2}go next my2(${call base})\n\n${end}"),
        new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(h);
    context.setVariable("util", new DefaultStaticMethods());

    // test 1
    String q = env.executeTemplate("overrides.my1", context, null, null);
    Assert.assertEquals("my1\n", q);
View Full Code Here


    Assert.assertEquals(8, cache.lookup(new Object[] { 3,4,7}, 9));
    Assert.assertEquals(null, cache.lookup(new Object[] { 3,5,7}, 9));
  }

  public void testIds() {
    DefaultStaticMethods util = new DefaultStaticMethods();
    Assert.assertEquals("CamelCase", util.toCamelCase("camel_case", true));
    Assert.assertEquals("camelCase", util.toCamelCase("camel_case", false));
    Assert.assertEquals("camelCase", util.toCamelCase("_camel_case", false));
    Assert.assertEquals("toDo", util.toCamelCase("_to_do_", false));
    Assert.assertEquals("ToDo", util.toCamelCase("_to_do_", true));
  }
View Full Code Here

  // filter.ltp
  public void testMap() {
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(null);
    context.setVariable("util", new DefaultStaticMethods());

    // test 1
    String q = env.executeTemplate("filter.map1", context, null, null);
    Assert.assertEquals("[nbsss -> a3,a45 -> 943q,ano -> yes]\n", q);
  }
View Full Code Here

  }

  public void testCollect() {
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(null);
    context.setVariable("util", new DefaultStaticMethods());

    // test 1
    String q = env.executeTemplate("filter.collectorUnique", context, null, null);
    Assert.assertEquals("1A BB C D ", q);
View Full Code Here

  }

  public void testCollectMap() {
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(null);
    context.setVariable("util", new DefaultStaticMethods());

    // test 1
    String q = env.executeTemplate("filter.collector1", context, null, null);
    Assert.assertEquals("[1a -> 1A,Bb -> BB,c -> C,d -> D]", q);
  }
View Full Code Here

  }

  public void testSort() {
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(null);
    context.setVariable("util", new DefaultStaticMethods());

    // test 1
    String q = env.executeTemplate("filter.sorted1", context, null, null);
    Assert.assertEquals("1a -> yo4; a -> yo1; daa -> yo2; xb -> yo3; ", q);
View Full Code Here

  public void testCall() {
    Hashtable<String,String[]> h = new Hashtable<String,String[]>();
    h.put("list", new String[] { "a", "b" });
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(h);
    context.setVariable("util", new DefaultStaticMethods());

    // test 1
    String q = env.executeTemplate("format.callTempl", context, null, null);
    Assert.assertEquals("\nstatic int a[] {\n  0,\n1,\n2,\n3\n};\n\n", q);
View Full Code Here

TOP

Related Classes of net.sf.lapg.templates.api.impl.DefaultStaticMethods

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.