public void assertNoResponse() { assertResponse(null); }
public void assertRender(String expectedTarget, Map<String, String> expectedArguments) { assertRender(application.resolveBean(ControllerService.class).getDescriptor().getMethodById(expectedTarget).getHandle(), expectedArguments); }
@Test public void testNoOp() throws Exception { MockApplication<?> app = application("plugin.controller.action.noop").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); MockActionBridge action = (MockActionBridge)client.invoke(render.assertStringResponse()); action.assertNoResponse(); }
private void assertBean(MockClient client, String name, Object expected) throws Exception { MockViewBridge render = client.render(name); String url = render.assertStringResponse(); MockViewBridge m = (MockViewBridge)client.invoke(url); assertEquals(expected, m.assertStringResponse()); render = client.render(name + "Action"); url = render.assertStringResponse(); MockActionBridge action = (MockActionBridge)client.invoke(url); MockViewBridge m2 = (MockViewBridge)client.invoke(action.assertUpdate()); assertEquals(expected, m2.assertStringResponse()); }
public String assertUpdate() { if (response instanceof Response.View) { Response.View view = (Response.View)response; Phase.View.Dispatch update = (Phase.View.Dispatch)view; DispatchBridge spi = createDispatch(Phase.VIEW, update.getTarget(), update.getParameters()); Phase.View.Dispatch dispatch = new Phase.View.Dispatch(spi); return dispatch.with(update.getProperties()).toString(); } else { throw AbstractTestCase.failure("Was expecting an update instead of " + response); } }
@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"); }
request = new MockActionBridge(application.getLifeCycle(), this, handler.getHandle(), parameters); } else if (handler.getPhase() == Phase.VIEW) { request = new MockViewBridge(application.getLifeCycle(), this, handler.getHandle(), parameters);
public void assertRender(String expectedTarget, Map<String, String> expectedArguments) { assertRender(application.resolveBean(ControllerService.class).getDescriptor().getMethodById(expectedTarget).getHandle(), expectedArguments); }
@Test public void testNoOp() throws Exception { MockApplication<?> app = application("plugin.controller.action.noop").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); MockActionBridge action = (MockActionBridge)client.invoke(render.assertStringResponse()); action.assertNoResponse(); }
private void assertBean(MockClient client, String name, Object expected) throws Exception { MockViewBridge render = client.render(name); String url = render.assertStringResponse(); MockViewBridge m = (MockViewBridge)client.invoke(url); assertEquals(expected, m.assertStringResponse()); render = client.render(name + "Action"); url = render.assertStringResponse(); MockActionBridge action = (MockActionBridge)client.invoke(url); MockViewBridge m2 = (MockViewBridge)client.invoke(action.assertUpdate()); assertEquals(expected, m2.assertStringResponse()); }
public String assertUpdate() { if (response instanceof Response.View) { Response.View view = (Response.View)response; Phase.View.Dispatch update = (Phase.View.Dispatch)view; DispatchBridge spi = createDispatch(Phase.VIEW, update.getTarget(), update.getParameters()); Phase.View.Dispatch dispatch = new Phase.View.Dispatch(spi); return dispatch.with(update.getProperties()).toString(); } else { throw AbstractTestCase.failure("Was expecting an update instead of " + response); } }
@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"); }
request = new MockActionBridge(application.getLifeCycle(), this, handler.getHandle(), parameters); } else if (handler.getPhase() == Phase.VIEW) { request = new MockViewBridge(application.getLifeCycle(), this, handler.getHandle(), parameters);
@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")); } }
public void assertNoResponse() { assertResponse(null); }
@Test public void testUpdate() throws Exception { MockApplication<?> app = application("plugin.controller.view.update").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); String result = render.assertStringResponse(); MockActionBridge action = (MockActionBridge)client.invoke(result); action.assertRender("A.done", Collections.<String, String>emptyMap()); } }
public void assertRedirect(String location) { assertResponse(new Response.Redirect(location)); }
@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")); } }
public void assertRedirect(String location) { assertResponse(new Response.Redirect(location)); }
@Test public void testUpdate() throws Exception { MockApplication<?> app = application("plugin.controller.view.update").init(); // MockClient client = app.client(); MockViewBridge render = client.render(); String result = render.assertStringResponse(); MockActionBridge action = (MockActionBridge)client.invoke(result); action.assertRender("A.done", Collections.<String, String>emptyMap()); } }