Class StandaloneMockMvcBuilder

All Implemented Interfaces:
MockMvcBuilder, ConfigurableMockMvcBuilder<StandaloneMockMvcBuilder>

public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneMockMvcBuilder>
A MockMvcBuilder that accepts @Controller registrations thus allowing full control over the instantiation and initialization of controllers and their dependencies similar to plain unit tests, and also making it possible to test one controller at a time.

This builder creates the minimum infrastructure required by the DispatcherServlet to serve requests with annotated controllers and also provides methods for customization. The resulting configuration and customization options are equivalent to using MVC Java config except using builder style methods.

To configure view resolution, either select a "fixed" view to use for every request performed (see setSingleView(View)) or provide a list of ViewResolvers (see setViewResolvers(ViewResolver...)).

Since:
3.2
Author:
Rossen Stoyanchev