@Test public void testIncludeCircular() throws Exception { List<CompilationError> errors = compiler("plugin.template.tag.includecircular").formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertEquals(TemplateMetaModel.TEMPLATE_CYCLE, error.getCode()); assertEquals(Arrays.asList( "Path[/plugin/template/tag/includecircular/templates/index.gtmpl]", "/plugin/template/tag/includecircular/templates/index.gtmpl->/plugin/template/tag/includecircular/templates/foo.gtmpl"), error.getArguments()); }
@Test public void testNotFound() throws Exception { List<CompilationError> errors = compiler("plugin.template.tag.notfound").formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertTrue(error.getSource().endsWith("template/tag/notfound/A.java")); assertEquals(TemplateMetaModel.UNKNOWN_TAG, error.getCode()); assertEquals(Arrays.asList("notfound"), error.getArguments()); }
@Test public void testNotFound() throws Exception { List<CompilationError> errors = compiler("plugin.template.tag.notfound").formalErrorReporting(true).failCompile(); assertEquals(1, errors.size()); CompilationError error = errors.get(0); assertTrue(error.getSource().endsWith("template/tag/notfound/A.java")); assertEquals(TemplateMetaModel.UNKNOWN_TAG, error.getCode()); assertEquals(Arrays.asList("notfound"), error.getArguments()); }
@Test public void testTitle() throws Exception { MockApplication<?> app = application("plugin.template.tag.title").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); String url = render.assertStringResponse(); assertEquals("the_title", render.getTitle()); render = (MockViewBridge)client.invoke(url); assertEquals("4", render.getTitle()); }
@Test public void testTitle() throws Exception { MockApplication<?> app = application("plugin.template.tag.title").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); String url = render.assertStringResponse(); assertEquals("the_title", render.getTitle()); render = (MockViewBridge)client.invoke(url); assertEquals("4", render.getTitle()); }
@Test public void testInclude() throws Exception { MockApplication<?> app = application("plugin.template.tag.include").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("foo", out); }
@Test public void testSimpleNested() throws Exception { MockApplication<?> app = application("plugin.template.tag.simple.nested").init(); MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("<index><foo><bar>foo_content</bar></foo></index>", out); }
@Test public void testIncludeTwice() throws Exception { MockApplication<?> app = application("plugin.template.tag.includetwice").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("foofoo", out); }
@Test public void testDecorate() throws Exception { MockApplication<?> app = application("plugin.template.tag.decorate").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("<foo>bar</foo>", out); }
@Test public void testSimpleRender() throws Exception { MockApplication<?> app = application("plugin.template.tag.simple.render").init(); MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("foothe_tagbar", out); }
@Test public void testSimpleInclude() throws Exception { MockApplication<?> app = application("plugin.template.tag.simple.include").init(); MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("pass", out); }
@Test public void testDecorateNested() throws Exception { MockApplication<?> app = application("plugin.template.tag.decoratenested").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("<juu><foo>bar</foo></juu>", out); }
@Test public void testIncludeDouble() throws Exception { MockApplication<?> app = application("plugin.template.tag.includedouble").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("foobar", out); }
@Test public void testSimpleNested() throws Exception { MockApplication<?> app = application("plugin.template.tag.simple.nested").init(); MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("<index><foo><bar>foo_content</bar></foo></index>", out); }
@Test public void testInclude() throws Exception { MockApplication<?> app = application("plugin.template.tag.include").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("foo", out); }
@Test public void testSimpleBody() throws Exception { MockApplication<?> app = application("plugin.template.tag.simple.body").init(); MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("<foo>the_body</foo>", out); }
@Test public void testDecorate() throws Exception { MockApplication<?> app = application("plugin.template.tag.decorate").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("<foo>bar</foo>", out); }
@Test public void testSimpleRender() throws Exception { MockApplication<?> app = application("plugin.template.tag.simple.render").init(); MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("foothe_tagbar", out); }
@Test public void testSimpleInclude() throws Exception { MockApplication<?> app = application("plugin.template.tag.simple.include").init(); MockClient client = app.client(); MockViewBridge render = client.render(); String out = render.assertStringResponse(); assertEquals("pass", out); }
@Test public void testParam() throws Exception { if (getDI() != InjectorProvider.GUICE) { MockApplication<?> app = application("plugin.template.tag.param").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); String content = render.assertStringResponse(); assertEquals("foo_value", content); } }