Package org.untmpl

Examples of org.untmpl.Template


  public void testClean() throws IOException {
    // Load the template.
    String serializedTemplate = Utils
        .readFile("data/validation/fisk12mapping.txt");
    Template template = Template.unserialize(serializedTemplate);

    // Parse the first file using the template.
    String document0 = Utils.readFile("data/test/fisk1.html");
    String correct0 = Utils.readFile("data/validation/fisk1.content.html");
    String cleaned0 = template.clean(document0);

    correct0 = correct0.replaceAll("\\s", "");
    cleaned0 = cleaned0.replaceAll("\\s", "");

    assertEquals(correct0, cleaned0);

    // Parse the second file using the template.
    String document1 = Utils.readFile("data/test/fisk2.html");
    String correct1 = Utils.readFile("data/validation/fisk2.content.html");
    String cleaned1 = template.clean(document1);

    correct1 = correct1.replaceAll("\\s", "");
    cleaned1 = cleaned1.replaceAll("\\s", "");

    assertEquals(correct1, cleaned1);
View Full Code Here


  public void testSerialize() throws IOException {
    // Check that the serialization and un-serialization produce the same
    // data.
    String correct = Utils.readFile("data/validation/fisk12mapping.txt");

    Template template = Template.unserialize(correct);

    Writer writer = new StringWriter();
    template.serialize(writer);

    assertEquals(correct, writer.toString());
  }
View Full Code Here

    String[] documents = new String[] {
        "<html><body><div class=\"main\">content1</div></body></html>",
        "<html><body><div class=\"main\">content2</div></body></html>", };
    String correct = "0";

    Template template = Template.find(documents);

    Writer writer = new StringWriter();
    template.serialize(writer);

    assertEquals(correct.trim(), writer.toString().trim());
  }
View Full Code Here

    String[] documents = new String[] {
        "<html><body><div>header1</div><div>content1</div><div>common footer</div></body></html>",
        "<html><body><div>header2</div><div>content2</div><div>common footer</div></body></html>", };
    String correct = "1,2;0";

    Template template = Template.find(documents);

    Writer writer = new StringWriter();
    template.serialize(writer);

    assertEquals(correct.trim(), writer.toString().trim());
  }
View Full Code Here

    String[] documents = new String[] {
        "<html><body><div>content1_part1</div><div>content1_part2</div></body></html>",
        "<html><body><div>content2_part1</div></body></html>", };
    String correct = "0";

    Template template = Template.find(documents);

    Writer writer = new StringWriter();
    template.serialize(writer);

    assertEquals(correct.trim(), writer.toString().trim());
  }
View Full Code Here

    String[] documents = new String[] {
        "<html><body><div>content1_part1</div><div>content1_part2</div><div>footer</div></body></html>",
        "<html><body><div>content2_part1</div><div>footer</div></body></html>", };
    String correct = "0";

    Template template = Template.find(documents);

    Writer writer = new StringWriter();
    template.serialize(writer);

    assertEquals(correct.trim(), writer.toString().trim());
  }
View Full Code Here

    String[] documents = new String[] {
        Utils.readFile("data/test/fisk1.html"),
        Utils.readFile("data/test/fisk2.html"), };

    Template template = Template.find(documents);

    Writer writer = new StringWriter();
    template.serialize(writer);

    assertEquals(correct.trim(), writer.toString().trim());
  }
View Full Code Here

TOP

Related Classes of org.untmpl.Template

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.