Confusing mockMvc asserts on async result [SPR-17543] #22075
Labels
in: test
Issues in the test module
status: declined
A suggestion or change that we don't feel we should currently apply
Lukas Krecan opened SPR-17543 and commented
Let's take the following test of an asynchronous API
We execute the request and check the status at once. Surprisingly it passes, even if the result is not ready yet and the final status will be different. I would except first
.andExpect(status().isOk())
to fail since the result has not yet arrived (IllegalStateException?).It's especially surprising if you forget that you have to test async controllers differently. Then you spend nontrivial amount of time investigating why your controller is returning 200 when you expect it to return an error.
Affects: 5.1.2
The text was updated successfully, but these errors were encountered: