Package juzu.test.protocol.mock

Examples of juzu.test.protocol.mock.MockClient.render()


  public void testNotFound() throws Exception {
    MockApplication<?> app = application("plugin.controller.resource.notfound").init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    MockResourceBridge resource = (MockResourceBridge)client.invoke(render.assertStringResponse());
    resource.assertNotFound();
  }

  @Test
View Full Code Here


  public void testBinary() throws Exception {
    MockApplication<?> app = application("plugin.controller.resource.binary").init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    MockResourceBridge resource = (MockResourceBridge)client.invoke(render.assertStringResponse());
    assertEquals("hello", new String(resource.assertBinaryResponse(), "UTF-8"));
    assertEquals("application/octet-stream", resource.getMimeType());
  }
}
View Full Code Here

    if (getDI() == InjectorProvider.WELD) {
      MockApplication<?> app = application("plugin.controller.predestroy").init();

      //
      MockClient client = app.client();
      client.render();
      Integer count = Registry.get("count");
      assertEquals((Integer)1, count);
    }
  }
}
View Full Code Here

    //
    MockClient client = app.client();

    //
    client.render();
    long id1 = Registry.<Long>unset("car");
    int status = Registry.<Integer>unset("status");
    assertEquals(Identifiable.MANAGED, status);
    assertEquals(1, client.getFlashHistory(1).size());
    Identifiable car1 = (Identifiable)client.getFlashHistory(1).iterator().next().get();
View Full Code Here

    Identifiable car2 = (Identifiable)client.getFlashHistory(0).iterator().next().get();
    assertNotSame(car1, car2);
    assertEquals(Identifiable.MANAGED, car2.getStatus());

    //
    client.render();
    long id3 = Registry.<Long>unset("car");
    status = Registry.<Integer>unset("status");
    assertEquals(Identifiable.MANAGED, status);
    assertEquals(id2, id3);
    assertEquals(1, client.getFlashHistory(1).size());
View Full Code Here

    //
    MockClient client = app.client();

    //
    client.render();
    long id1 = Registry.<Long>unset("car");
    int status = Registry.<Integer>unset("status");
    assertEquals(Identifiable.MANAGED, status);
    assertEquals(1, client.getSession().size());
    Identifiable car1 = (Identifiable)client.getSession().iterator().next().get();
View Full Code Here

    Identifiable car2 = (Identifiable)client.getSession().iterator().next().get();
    assertSame(car1, car2);
    assertEquals(Identifiable.MANAGED, car2.getStatus());

    //
    client.render();
    long id3 = Registry.<Long>unset("car");
    status = Registry.<Integer>unset("status");
    assertEquals(Identifiable.MANAGED, status);
    assertEquals(id2, id3);
    assertEquals(1, client.getSession().size());
View Full Code Here

  public void testChecked() throws Exception {
    MockApplication<?> app = application("plugin.template.throwable.checked").init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    TemplateExecutionException te = render.assertFailure(TemplateExecutionException.class);
    assertInstanceOf(AuthenticationException.class, te.getCause());
  }

  @Test
View Full Code Here

  public void testRuntime() throws Exception {
    MockApplication<?> app = application("plugin.template.throwable.runtime").init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    TemplateExecutionException te = render.assertFailure(TemplateExecutionException.class);
    assertInstanceOf(ConcurrentModificationException.class, te.getCause());
  }

  @Test
View Full Code Here

  public void testError() throws Exception {
    MockApplication<?> app = application("plugin.template.throwable.error").init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    render.assertFailure(UnknownError.class);
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.