Add missing debug(Writer) alternative

See gh-33059
This commit is contained in:
Stéphane Nicoll
2024-06-18 12:40:29 +02:00
parent 54c37ffd6f
commit a1b0099795
2 changed files with 21 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import jakarta.servlet.http.Cookie;
import org.assertj.core.api.AbstractStringAssert;
@@ -158,6 +159,16 @@ public class MvcTestResultAssert extends AbstractMockHttpServletResponseAssert<M
return apply(MockMvcResultHandlers.print(stream));
}
/**
* Print {@link MvcResult} details to the supplied {@link Writer}.
* <p>You must call it <b>before</b> calling the assertion otherwise it is ignored
* as the failing assertion breaks the chained call by throwing an
* AssertionError.
*/
public MvcTestResultAssert debug(Writer writer) {
return apply(MockMvcResultHandlers.print(writer));
}
/**
* Verify that the request has failed.
*/