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