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.