Exemplo n.º 1
0
 @Test
 public void bindFromRequest() {
   Result result =
       MockJavaAction.call(
           new Controller1(),
           fakeRequest().withFormUrlEncodedBody(ImmutableMap.of("email", "e", "password", "p")));
   assertThat(contentAsString(result), equalTo("e"));
 }
Exemplo n.º 2
0
 @Test
 public void dynamicForm() {
   Result result =
       MockJavaAction.call(
           new Controller3(),
           fakeRequest()
               .withFormUrlEncodedBody(ImmutableMap.of("firstname", "a", "lastname", "b")));
   assertThat(contentAsString(result), equalTo("Hello a b"));
 }
Exemplo n.º 3
0
 @Test
 public void handleErrors() {
   Result result = MockJavaAction.call(new Controller2(), fakeRequest());
   assertThat(contentAsString(result), startsWith("Got user"));
 }