Package juzu.test.protocol.mock

Examples of juzu.test.protocol.mock.MockClient


  @Test
  public void testResourceRuntime() throws Exception {
    MockApplication<?> app = application("plugin.controller.resource.throwable.runtime").init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    MockRequestBridge request = client.invoke(render.assertStringResponse());
    request.assertFailure(ConcurrentModificationException.class);
  }
View Full Code Here


  @Test
  public void testResourceError() throws Exception {
    MockApplication<?> app = application("plugin.controller.resource.throwable.error").init();

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

  @Test
  public void testImplicit() throws Exception {
    MockApplication<?> app = application("plugin.template.printer").init();

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

    MockApplication<?> app = new MockApplication<File>(
        helper,
        di,
        Name.parse("plugin.template.external"));
    app.init();
    MockClient client = app.client();
    assertEquals("hello", client.render().assertStringResponse());
  }
View Full Code Here

  }

  @Test
  public void testRelativePath() throws Exception {
    MockApplication<?> app = application("plugin.template.relativepath").init();
    MockClient client = app.client();
    assertEquals("relative_path_template", client.render().assertStringResponse());
  }
View Full Code Here

  }

  @Test
  public void testTyped() throws Exception {
    MockApplication<?> app = application("plugin.template.typed").init();
    MockClient client = app.client();
    assertEquals("typed_template", client.render().assertStringResponse());
  }
View Full Code Here

  }

  @Test
  public void testUndeclaredIOE() throws Exception {
    MockApplication<?> app = application("plugin.template.ioe").init();
    MockClient client = app.client();
    assertEquals("pass", client.render().assertStringResponse());
  }
View Full Code Here

  @Test
  public void testMessage() throws Exception {
    MockApplication<?> app = application("plugin.template.message").init();
    app.addMessage(Locale.ENGLISH, "the_key", "the_key_en");
    MockClient client = app.client();
    assertEquals("(the_key_en,)", client.render().assertStringResponse());
  }
View Full Code Here

    config.setTargetDirectory(fs.getRoot());
    CompilationUnit cu = new CompilationUnit(config);
    cu.addSource(groovy);
    cu.compile();
    assertTrue(groovy.delete());
    MockClient client = app.client();
    assertEquals("hello", client.render().assertStringResponse());
  }
View Full Code Here

  @Test
  public void testRequestScope() throws Exception {
    MockApplication<?> app = application("plugin.controller.scope.request").init();

    //
    MockClient client = app.client();

    //
    MockRequestBridge request = client.render();
    List<Scoped> attributes = request.getAttributesHistory();
    assertEquals(1, attributes.size());
    Identifiable car = (Identifiable)attributes.iterator().next().get();
    assertEquals(Identifiable.DESTROYED, car.getStatus());

    //
    long id1 = Registry.<Long>unset("car");
    assertEquals(car.getIdentityHashCode(), id1);
    assertEquals(Identifiable.MANAGED, (int)Registry.<Integer>unset("status"));

    //
    request = client.invoke(Registry.<String>unset("action"));
    attributes = request.getAttributesHistory();
    assertEquals(1, attributes.size());
    car = (Identifiable)attributes.iterator().next().get();
    assertEquals(Identifiable.DESTROYED, car.getStatus());

    //
    long id2 = Registry.<Long>unset("car");
    assertNotSame(id1, id2);
    assertEquals(id2, id2);
    assertEquals(Identifiable.MANAGED, (int)Registry.<Integer>unset("status"));

    //
    request = client.invoke(Registry.<String>unset("resource"));
    attributes = request.getAttributesHistory();
    assertEquals(1, attributes.size());
    car = (Identifiable)attributes.iterator().next().get();
    assertEquals(Identifiable.DESTROYED, car.getStatus());
View Full Code Here

TOP

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

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.