interface ConfigurableMockMvcBuilder<B : ConfigurableMockMvcBuilder<B>> : MockMvcBuilder
Defines common methods for building a MockMvc.
Author
Rossen Stoyanchev
Since
4.1
abstract fun <T : B> addFilter(filter: Filter, vararg urlPatterns: String): T
Add a filter mapped to a specific set of patterns. For example:
is the equivalent of:
Filters will be invoked in the order in which they are provided. |
|
abstract fun <T : B> addFilters(vararg filters: Filter): T
Add filters mapped to any request (i.e. "/*"). For example:
is the equivalent of the following web.xml configuration:
Filters will be invoked in the order in which they are provided. |
|
abstract fun <T : B> alwaysDo(resultHandler: ResultHandler): T
Define a global action that should always be applied to every response. For example, writing detailed information about the performed request and resulting response to |
|
abstract fun <T : B> alwaysExpect(resultMatcher: ResultMatcher): T
Define a global expectation that should always be applied to every response. For example, status code 200 (OK), content type |
|
abstract fun <T : B> apply(configurer: MockMvcConfigurer): T
Add a There is a built-in SharedHttpSessionConfigurer that can be used to re-use the HTTP session across requests. 3rd party frameworks like Spring Security also use this mechanism to provide configuration shortcuts. |
|
abstract fun <T : B> defaultRequest(requestBuilder: RequestBuilder): T
Define default request properties that should be merged into all performed requests. In effect this provides a mechanism for defining common initialization for all requests such as the content type, request parameters, session attributes, and any other request property. Properties specified at the time of performing a request override the default properties defined here. |
|
abstract fun <T : B> dispatchOptions(dispatchOptions: Boolean): T
Whether to enable the DispatcherServlet property |