We\'re trying to set up Spring-Test-MVC for our Spring-MVC web app. We started out using freemarker and everything was fine. We decided against it though and are now trying
I have created a modified version of MockRequestDispatcher that builds the same chain as MockMvc and passes the request to that chain for forward requests. That fixes this issue for me. Some more work has to be done if the view is rendered outside of the dispatcher servlet (e.g. via jsp).
The code is there: https://gist.github.com/micw/a8b20720db900762a29d
Most work was to inject it at the right place. I did this my creating a RequestPostProcessor for MockMvc and some mockito-magic that intercepts the MockHttpServletRequest.getRequestDispatcher call.
To use it, add it to your test classpath and call it directly after creating your MockMvc instance:
mvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)
[...]
.build();
WebMvcRequestDispatcherForwardFix.apply(mvc);