Document AssertJ support for MockMvc

This commit restructures the section on MockMvc so that the anchors
are easier to read. The standard integration has moved to a
Hamcrest Integration section  at the same level as HtmlUnit Integration,
and a new AssertJ Integration section has been created.

Closes gh-32454
This commit is contained in:
Stéphane Nicoll
2024-06-21 12:50:36 +02:00
parent 7d236e29bb
commit d43dba63a1
54 changed files with 1432 additions and 272 deletions

View File

@@ -0,0 +1,16 @@
[[mockmvc-tester]]
= AssertJ Integration
:page-section-summary-toc: 1
The AssertJ integration builds on top of plain `MockMvc` with several differences:
* There is no need to use static imports as both the requests and assertions can be
crafted using a fluent API.
* Unresolved exceptions are handled consistently so that your tests do not need to
throw (or catch) `Exception`.
* By default, the result to assert is complete whether the processing is asynchronous
or not. In other words, there is no need for special handling for Async requests.
`MockMvcTester` is the entry point for the AssertJ support. It allows to craft the
request and return a result that is AssertJ compatible so that it can be wrapped in
a standard `assertThat()` method.