public void testReadmeParallel() throws MustacheException, IOException { MustacheFactory c = initParallel(); Mustache m = c.compile("items2.html"); StringWriter sw = new StringWriter(); long start = System.currentTimeMillis(); m.execute(sw, new Context()).close(); long diff = System.currentTimeMillis() - start; assertEquals(getContents(root, "items.txt"), sw.toString()); assertTrue("Should be a little bit more than 1 second: " + diff, diff > 999 && diff < 2000); }
public void testReadme() throws MustacheException, IOException { MustacheFactory c = createMustacheFactory(); Mustache m = c.compile("items.html"); StringWriter sw = new StringWriter(); long start = System.currentTimeMillis(); m.execute(sw, new Context()); long diff = System.currentTimeMillis() - start; assertEquals(getContents(root, "items.txt"), sw.toString()); }
public void testReadmeSerial() throws MustacheException, IOException { MustacheFactory c = createMustacheFactory(); Mustache m = c.compile("items2.html"); StringWriter sw = new StringWriter(); long start = System.currentTimeMillis(); m.execute(sw, new Context()); long diff = System.currentTimeMillis() - start; assertEquals(getContents(root, "items.txt"), sw.toString()); assertTrue("Should be a little bit more than 4 seconds: " + diff, diff > 3999 && diff < 6000); }
public void testLimitedDepthRecursion() { try { StringWriter sw = execute("infiniteparent.html", new Context()); fail("Should have failed"); } catch (StackOverflowError soe) { fail("Should not have overflowed the stack"); } catch (MustacheException e) { assertEquals("Maximum partial recursion limit reached: 100 @[infiniteparent.html:1]", e.getMessage()); } }