Package org.springframework.test.web.servlet.setup
@NullMarked
package org.springframework.test.web.servlet.setup
Contains built-in
MockMvcBuilder implementations.
Use MockMvcBuilders
to access to instances of those implementations.-
ClassDescriptionAbstractMockMvcBuilder<B extends AbstractMockMvcBuilder<B>>Abstract implementation of
MockMvcBuilderwith common methods for configuring filters, default request properties, global expectations and global result actions.ConfigurableMockMvcBuilder<B extends ConfigurableMockMvcBuilder<B>>Defines common methods for building aMockMvc.A concrete implementation ofAbstractMockMvcBuilderthat provides theWebApplicationContextsupplied to it as a constructor argument.The main class to import in order to access all availableMockMvcBuilders.Contract for customizing aConfigurableMockMvcBuilderin some specific way, for example, a 3rd party library that wants to provide shortcuts for setting up a MockMvc.An empty method implementation ofMockMvcConfigurer.AMockMvcBuilderthat acceptsRouterFunctionregistrations thus allowing full control over the instantiation and initialization of router functions and their dependencies similar to plain unit tests, and also making it possible to test one function at a time.MockMvcConfigurerthat stores and re-uses the HTTP session across multiple requests performed through the sameMockMvcinstance.AMockMvcBuilderthat accepts@Controllerregistrations 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.