Package juzu.test.protocol.mock

Examples of juzu.test.protocol.mock.MockViewBridge


  private void assertRolesAllowed(String packageName) throws Exception {
    MockApplication<?> application = application(InjectorProvider.GUICE, packageName);
    application.init();
    MockClient client = application.client();
    MockViewBridge view1 = client.render();
    assertInstanceOf(Response.Error.Forbidden.class, view1.assertError());
    client.addRole("foo");
    MockViewBridge view2 = client.render();
    view2.assertOk();
  }
View Full Code Here


  private void assertPermitAll(String packageName) throws Exception {
    MockApplication<?> application = application(InjectorProvider.GUICE, packageName);
    application.init();
    MockClient client = application.client();
    MockViewBridge view1 = client.render();
    view1.assertOk();
    client.addRole("foo");
    MockViewBridge view2 = client.render();
    view2.assertOk();
  }
View Full Code Here

  private void assertDenyAll(String packageName) throws Exception {
    MockApplication<?> application = application(InjectorProvider.GUICE, packageName);
    application.init();
    MockClient client = application.client();
    MockViewBridge view1 = client.render();
    assertInstanceOf(Response.Error.Forbidden.class, view1.assertError());
    client.addRole("foo");
    MockViewBridge view2 = client.render();
    assertInstanceOf(Response.Error.Forbidden.class, view2.assertError());
  }
View Full Code Here

  @Test
  public void testBasic() throws Exception {
    MockApplication<?> app = application("basic").init();
    MockClient client = app.client();
    MockViewBridge render = client.render();
    assertEquals("foo", render.assertStringResponse());
  }
View Full Code Here

  @Test
  public void testResolveParameter() throws Exception {
    MockApplication<?> app = application("resolveparameter").init();
    MockClient client = app.client();
    MockViewBridge render = client.render();
    assertEquals("bar", render.assertStringResponse());
  }
View Full Code Here

  @Test
  public void testResolveBean() throws Exception {
    MockApplication<?> app = application("resolvebean").init();
    MockClient client = app.client();
    MockViewBridge render = client.render();
    assertEquals("bar", render.assertStringResponse());
  }
View Full Code Here

  @Test
  public void testPartial() throws Exception {
    MockApplication<?> app = application("partial").init();
    MockClient client = app.client();
    MockViewBridge render = client.render();
    assertEquals("<bar>foo</bar>", render.assertStringResponse());
  }
View Full Code Here

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

  public void testTimer() throws Exception {
    SharedMetricRegistries.clear();                                                             //<1>
    MockApplication<File> application = application(InjectorProvider.GUICE, "examples.metrics");//<2>
    application.init();
    MockClient client = application.client();
    MockViewBridge view = client.render();                                                      //<3>
    assertEquals("ok", view.assertStringResponse());
    assertEquals(Collections.singleton("examples.metrics"), SharedMetricRegistries.names());    //<4>
    MetricRegistry registry = SharedMetricRegistries.getOrCreate("examples.metrics");
    Timer timer = registry.getTimers().get("juzu.responses");                                   //<5>
    assertEquals(1, timer.getCount());
    Meter meter = registry.getMeters().get("custom");                                           //<6>
View Full Code Here

  @Test
  public void testResolveBundle() throws Exception {
    MockApplication<File> application = application(InjectorProvider.GUICE, "examples.app1"); //<1>
    application.init();                                                                       //<2>
    MockClient client = application.client();
    MockViewBridge view = client.render();                                                    //<3>
    String markup = view.assertStringResponse();
    assertEquals("<abc>def</abc>", markup);                                                   //<4>
  }
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.