Package juzu.test.protocol.mock

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


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

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


    MockApplication<?> app = application("plugin.controller.action.noop").init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    MockActionBridge action = (MockActionBridge)client.invoke(render.assertStringResponse());
    action.assertNoResponse();
  }

  @Test
  public void testRedirect() throws Exception {
View Full Code Here

    MockApplication<?> app = application("plugin.controller.action.redirect").init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    MockActionBridge action = (MockActionBridge)client.invoke(render.assertStringResponse());
    action.assertRedirect("http://www.julienviet.com");
  }

  @Test
  public void testRender() throws Exception {
View Full Code Here

    MockApplication<?> app = application("plugin.controller.action.render").init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    MockActionBridge action = (MockActionBridge)client.invoke(render.assertStringResponse());
    action.assertRender("render", Collections.singletonMap("arg", "arg_value"));
  }
}
View Full Code Here

    MockViewBridge render = client.render();
    String result = render.assertStringResponse();
    Matcher m = P.matcher(result);
    assertTrue("Was expecting " + result + " to match", m.matches());
    assertEquals("0", m.group(1));
    render = (MockViewBridge)client.invoke(m.group(2));
    m.reset(result = render.assertStringResponse());
    assertTrue("Was expecting " + result + " to match", m.matches());
    assertEquals("1", m.group(1));
    render = (MockViewBridge)client.invoke(m.group(2));
    m.reset(result = render.assertStringResponse());
View Full Code Here

    assertEquals("0", m.group(1));
    render = (MockViewBridge)client.invoke(m.group(2));
    m.reset(result = render.assertStringResponse());
    assertTrue("Was expecting " + result + " to match", m.matches());
    assertEquals("1", m.group(1));
    render = (MockViewBridge)client.invoke(m.group(2));
    m.reset(result = render.assertStringResponse());
    assertTrue("Was expecting " + result + " to match", m.matches());
    assertEquals("0", m.group(1));
  }
View Full Code Here

    MockViewBridge render = client.render();
    String result = render.assertStringResponse();
    Matcher m = P.matcher(result);
    assertTrue("Was expecting " + result + " to match", m.matches());
    assertEquals("0", m.group(1));
    render = (MockViewBridge)client.invoke(m.group(2));
    m.reset(result = render.assertStringResponse());
    assertTrue("Was expecting " + result + " to match", m.matches());
    assertEquals("1", m.group(1));
    render = (MockViewBridge)client.invoke(m.group(2));
    m.reset(result = render.assertStringResponse());
View Full Code Here

    assertEquals("0", m.group(1));
    render = (MockViewBridge)client.invoke(m.group(2));
    m.reset(result = render.assertStringResponse());
    assertTrue("Was expecting " + result + " to match", m.matches());
    assertEquals("1", m.group(1));
    render = (MockViewBridge)client.invoke(m.group(2));
    m.reset(result = render.assertStringResponse());
    assertTrue("Was expecting " + result + " to match", m.matches());
    assertEquals("2", m.group(1));
  }
View Full Code Here

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    String result = render.assertStringResponse();
    MockActionBridge action = (MockActionBridge)client.invoke(result);
    action.assertRender("A.done", Collections.<String, String>emptyMap());
  }
}
View Full Code Here

    MockApplication<?> app = application("plugin.controller.action.throwable.checked").init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    MockRequestBridge request = client.invoke(render.assertStringResponse());
    request.assertFailure(AuthenticationException.class);
  }

  @Test
  public void testActionRuntime() throws Exception {
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.