Examples of MockClient


Examples of juzu.test.protocol.mock.MockClient

  }

  @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

Examples of juzu.test.protocol.mock.MockClient

  }

  @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

Examples of juzu.test.protocol.mock.MockClient

  }

  @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

Examples of juzu.test.protocol.mock.MockClient

  }

  @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

Examples of juzu.test.protocol.mock.MockClient

  @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

Examples of juzu.test.protocol.mock.MockClient

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

Examples of juzu.test.protocol.mock.MockClient

  // tag::testResolveBundle[]
  @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

Examples of juzu.test.protocol.mock.MockClient

  @Test
  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

Examples of juzu.test.protocol.mock.MockClient

  }

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

Examples of juzu.test.protocol.mock.MockClient

  }

  @Test
  public void testLifeCycle() throws Exception {
    MockApplication app = application("juzu.lifecycle").init();
    MockClient client = app.client();
    o = null;
    client.render();
    ValidationError error = assertInstanceOf(ValidationError.class, o);
    Set<ConstraintViolation<Object>> violations = error.getViolations();
    assertEquals(1, violations.size());
  }
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.