Package juzu.test.protocol.mock

Examples of juzu.test.protocol.mock.MockViewBridge


  @Test
  public void testRequest() throws Exception {
    MockApplication<?> application = application(InjectorProvider.GUICE, "plugin.controller.contextual.request");
    application.init();
    MockClient client = application.client();
    MockViewBridge request = client.render();
    Assert.assertEquals("pass", request.assertStringResponse());
  }
View Full Code Here


    //
    MockClient client = app.client();

    //
    MockViewBridge render = client.render("none");
    MockViewBridge mv = (MockViewBridge)client.invoke(render.assertStringResponse());
    assertEquals("", mv.assertStringResponse());

    //
    render = client.render("0");
    mv = (MockViewBridge)client.invoke(render.assertStringResponse());
    assertEquals("", mv.assertStringResponse());

    //
    render = client.render("1");
    mv = (MockViewBridge)client.invoke(render.assertStringResponse());
    assertEquals(Arrays.asList("bar").toString(), mv.assertStringResponse());

    //
    render = client.render("2");
    mv = (MockViewBridge)client.invoke(render.assertStringResponse());
    assertEquals(Arrays.asList("bar_1", "bar_2").toString(), mv.assertStringResponse());
  }
View Full Code Here

    //
    MockClient client = app.client();

    //
    MockViewBridge render = client.render("none");
    MockViewBridge mv = (MockViewBridge)client.invoke(render.assertStringResponse());
    assertEquals("", mv.assertStringResponse());

    //
    render = client.render("0");
    mv = (MockViewBridge)client.invoke(render.assertStringResponse());
    assertEquals("", mv.assertStringResponse());

    //
    render = client.render("1");
    mv = (MockViewBridge)client.invoke(render.assertStringResponse());
    assertEquals(Arrays.asList("bar").toString(), mv.assertStringResponse());

    //
    render = client.render("2");
    mv = (MockViewBridge)client.invoke(render.assertStringResponse());
    assertEquals(Arrays.asList("bar_1", "bar_2").toString(), mv.assertStringResponse());
  }
View Full Code Here

    assertBean(client, "h", "s_valuev");

  }

  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());
  }
View Full Code Here

    //
    MockClient client = app.client();

    //
    MockViewBridge render = client.render("index");

    assertTrue(WAS_NULL);

//    MockRenderBridge mv = (MockRenderBridge)client.invoke(render.assertStringResult());
  }
View Full Code Here

    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()));
  }
View Full Code Here

    MockApplication<?> app = application("plugin.controller.url.escapexml");
    app.init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    JSON url = (JSON)JSON.parse(render.assertStringResponse());
    assertEquals(Boolean.TRUE, url.getJSON("properties").get(PropertyType.ESCAPE_XML.getClass().getName()));
  }
View Full Code Here

    MockApplication<?> app = application("plugin.controller.url.invalidproperty");
    app.init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    assertEquals("pass", render.assertStringResponse());
  }
View Full Code Here

  @Test
  public void testDispatch() throws Exception {
    MockApplication<?> app = application("plugin.controller.lifecycle.dispatch").init();
    MockClient client = app.client();
    MockViewBridge render = client.render();
    render.assertStringResponse("index");
    Integer count = Registry.get("count");
    assertEquals((Integer)2, count);
  }
View Full Code Here

  @Test
  public void testOverrideBegin() throws Exception {
    MockApplication<?> app = application("plugin.controller.lifecycle.overridebegin").init();
    MockClient client = app.client();
    MockViewBridge render = client.render();
    render.assertStringResponse("begin");
    Integer count = Registry.get("count");
    assertEquals((Integer)0, count);
  }
View Full Code Here

TOP

Related Classes of juzu.test.protocol.mock.MockViewBridge

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.