@Test public void testSimple() throws Exception { // We only use CDI for its capability to discover beans automatically MockApplication<?> application = application(InjectorProvider.WELD, "plugin.controller.contextual.simple"); application.init(); MockClient client = application.client(); MockViewBridge request = client.render(); Assert.assertEquals("__foo__", request.assertStringResponse()); }
@Test public void testRender() throws Exception { MockApplication<?> app = application("plugin.controller.action.render").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); MockActionBridge action = (MockActionBridge)client.invoke(render.assertStringResponse()); action.assertRender("render", Collections.singletonMap("arg", "arg_value")); } }
@Test public void testSimple() throws Exception { MockApplication<?> app = application("plugin.controller.url.simple"); app.init(); // MockClient client = app.client(); MockViewBridge render = client.render(); JSON url = (JSON)JSON.parse(render.assertStringResponse()); assertFalse(url.getJSON("properties").contains(PropertyType.ESCAPE_XML.getClass().getName())); }
@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 testResolveBean() throws Exception { MockApplication<?> app = application("plugin.template.el").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); assertEquals("A", render.assertStringResponse()); } }
@Test public void testQualifiedProvider() throws Exception { MockApplication<?> app = application("plugin.binding.provider.qualified").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); assertEquals("pass", render.assertStringResponse()); } }
@Test public void testCreate() throws Exception { MockApplication<?> app = application("plugin.binding.implementation.create").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); assertEquals("pass", render.assertStringResponse()); } }
@Test public void testTyped() throws Exception { MockApplication<?> app = application("plugin.template.typed").init(); MockClient client = app.client(); assertEquals("typed_template", client.render().assertStringResponse()); }
@Test public void testBasic() throws Exception { MockApplication<?> app = application("basic").init(); MockClient client = app.client(); MockViewBridge render = client.render(); assertEquals("foo", render.assertStringResponse()); }
@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 testBasic() throws Exception { MockApplication<?> app = application("basic").init(); MockClient client = app.client(); MockViewBridge render = client.render(); assertEquals("foo", render.assertStringResponse()); }
@Test public void testProvider() throws Exception { MockApplication<?> app = application("plugin.binding.provider.create").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); assertEquals("pass", render.assertStringResponse()); }
@Test public void testCreate() throws Exception { MockApplication<?> app = application("plugin.binding.create").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); assertEquals("pass", render.assertStringResponse()); }
@Test public void testRedirect() throws Exception { MockApplication<?> app = application("plugin.controller.action.redirect").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); MockActionBridge action = (MockActionBridge)client.invoke(render.assertStringResponse()); action.assertRedirect("http://www.julienviet.com"); }
@Test public void testActionRuntime() throws Exception { MockApplication<?> app = application("plugin.controller.action.throwable.runtime").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); MockRequestBridge request = client.invoke(render.assertStringResponse()); request.assertFailure(ConcurrentModificationException.class); }
@Test public void testParameterDeclaration() throws Exception { if (getDI() != InjectorProvider.GUICE) { MockApplication<?> app = application("parameterdeclaration").init(); MockClient client = app.client(); MockViewBridge render = client.render(); assertEquals("bar", render.assertStringResponse()); } } }
@Test public void testRedirect() throws Exception { MockApplication<?> app = application("plugin.controller.action.redirect").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); MockActionBridge action = (MockActionBridge)client.invoke(render.assertStringResponse()); action.assertRedirect("http://www.julienviet.com"); }
@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); } }
@Test public void testActionRuntime() throws Exception { MockApplication<?> app = application("plugin.controller.action.throwable.runtime").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); MockRequestBridge request = client.invoke(render.assertStringResponse()); request.assertFailure(ConcurrentModificationException.class); }
@Test public void testResourceError() throws Exception { MockApplication<?> app = application("plugin.controller.resource.throwable.error").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); MockRequestBridge request = client.invoke(render.assertStringResponse()); request.assertFailure(UnknownError.class); } }