@Test public void bindFromRequest() { Result result = MockJavaAction.call( new Controller1(), fakeRequest().withFormUrlEncodedBody(ImmutableMap.of("email", "e", "password", "p"))); assertThat(contentAsString(result), equalTo("e")); }
@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")); }
@Test public void handleErrors() { Result result = MockJavaAction.call(new Controller2(), fakeRequest()); assertThat(contentAsString(result), startsWith("Got user")); }