Package juzu.test.protocol.mock

Examples of juzu.test.protocol.mock.MockViewBridge


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

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    assertEquals("render_phase", render.assertStringResponse());

    //
    String url = render.getTitle();
    MockActionBridge action = (MockActionBridge)client.invoke(url);
    //
//      client.
//      client.invoke();
//      assertNull(Registry.get("car"));
View Full Code Here


  @Test
  public void testValidation() throws Exception {
    MockApplication app = application("juzu.simple").init();
    MockClient client = app.client();
    MockViewBridge render = client.render();
    ValidationError va = assertInstanceOf(ValidationError.class, render.getResponse());
    Set<ConstraintViolation<Object>> violations = va.getViolations();
    assertEquals(1, violations.size());
    ConstraintViolation<Object> violation = violations.iterator().next();
    assertEquals("may not be null", violation.getMessage());
    Iterator<Path.Node> path = violation.getPropertyPath().iterator();
View Full Code Here

  public void testLifeCycle() throws Exception {
    events.clear();
    MockApplication<?> app = application("plugin.controller.executionfilter.lifecycle").init();
    Tools.list(app.getLifeCycle().resolveBeans(RequestFilter.class));
    MockClient client = app.client();
    MockViewBridge render = client.render();
    assertEquals((Object)Arrays.asList("execute", "onCommand", "beforeRun", "run", "afterRun", "hello"), events);
  }
View Full Code Here

    MockApplication<File> application = application(InjectorProvider.GUICE, pkg);
    MockApplication<?> app = application.init();

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

    MockApplication<File> application = application(InjectorProvider.GUICE, pkg);
    MockApplication<?> app = application.init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    MockViewBridge action = (MockViewBridge)client.invoke(render.assertStringResponse());
    return action.assertFailure(expected);
  }
View Full Code Here

    MockApplication<File> application = application(InjectorProvider.GUICE, pkg);
    MockApplication<?> app = application.init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    String url = render.assertStringResponse();
    JSON json = (JSON)JSON.parse(url);
    json.set("parameters", new JSON());
    MockViewBridge action = (MockViewBridge)client.invoke(json.toString());
    String result = action.assertStringResponse();
    assertEquals("pass", result);
  }
View Full Code Here

  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();
  }
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

  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());
  }
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());
  }
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.