@@ -4020,7 +4020,7 @@ asserts that binding/validation failed:
40204020 .andExpect(model().attributeHasErrors("person"));
40214021----
40224022
4023- Many times when writing tests, it's useful to dump the result of the performed request.
4023+ Many times when writing tests, it's useful to _dump_ the results of the performed request.
40244024This can be done as follows, where `print()` is a static import from
40254025`MockMvcResultHandlers`:
40264026
@@ -4033,8 +4033,15 @@ This can be done as follows, where `print()` is a static import from
40334033 .andExpect(model().attributeHasErrors("person"));
40344034----
40354035
4036- As long as request processing causes an unhandled exception, the `print()` method will
4037- print all the available result data to `System.out`.
4036+ As long as request processing does not cause an unhandled exception, the `print()` method
4037+ will print all the available result data to `System.out`. Spring Framework 4.2 introduces
4038+ a new `log()` method and two additional variants of the `print()` method: one that accepts
4039+ an `OutputStream` and one that accepts a `Writer`. For example, invoking
4040+ `print(System.err)` will print the result data to `System.err`; while invoking
4041+ `print(myWriter)` will print the result data to a custom writer. If you would like to
4042+ have the result data _logged_ instead of printed, simply invoke the `log()` method which
4043+ will log the result data as a single `DEBUG` message under the
4044+ `org.springframework.test.web.servlet.result` logging category.
40384045
40394046In some cases, you may want to get direct access to the result and verify something that
40404047cannot be verified otherwise. This can be done by appending `.andReturn()` at the end
0 commit comments