You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your @Controller method puts something in the ModelAndView map that throws an exception from its toString() (e.g. easy to do with anything in @RequestScope) a MockMvc test will, rather mysteriously, fail on that endpoint. It turns out that SpringBootMockMvcBuilderCustomizer is collecting "lines" of diagnostic data that it will eventually discard because DEBUG logging is off by default, but one of those lines contains the model map exposed via toString(), so it blows up before it has a chance to even decide whether it is discarding. It would be better to catch the exception and maybe report that as part of the diagnostics? Or maybe not even collect the data if it is going to be discarded anyway.
The text was updated successfully, but these errors were encountered:
If your
@Controller
method puts something in theModelAndView
map that throws an exception from itstoString()
(e.g. easy to do with anything in@RequestScope
) aMockMvc
test will, rather mysteriously, fail on that endpoint. It turns out thatSpringBootMockMvcBuilderCustomizer
is collecting "lines" of diagnostic data that it will eventually discard because DEBUG logging is off by default, but one of those lines contains the model map exposed viatoString()
, so it blows up before it has a chance to even decide whether it is discarding. It would be better to catch the exception and maybe report that as part of the diagnostics? Or maybe not even collect the data if it is going to be discarded anyway.The text was updated successfully, but these errors were encountered: