Interface MockMvcWebTestClient.ControllerSpec
- All Superinterfaces:
MockMvcWebTestClient.MockMvcServerSpec<MockMvcWebTestClient.ControllerSpec>
- Enclosing interface:
- MockMvcWebTestClient
MockMvc
to test one or more
controllers directly, and a simple facade around
StandaloneMockMvcBuilder
.-
Method Summary
Modifier and TypeMethodDescriptionasyncRequestTimeout
(long timeout) Specify the timeout value for async execution.contentNegotiationManager
(org.springframework.web.accept.ContentNegotiationManager manager) Set a ContentNegotiationManager.controllerAdvice
(Object... controllerAdvice) RegisterControllerAdvice
conversionService
(org.springframework.format.support.FormattingConversionService conversionService) Provide a conversion service.customArgumentResolvers
(org.springframework.web.method.support.HandlerMethodArgumentResolver... argumentResolvers) Provide custom argument resolvers.customHandlerMapping
(Supplier<org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping> factory) Configure factory for a customRequestMappingHandlerMapping
.customReturnValueHandlers
(org.springframework.web.method.support.HandlerMethodReturnValueHandler... handlers) Provide custom return value handlers.flashMapManager
(org.springframework.web.servlet.FlashMapManager flashMapManager) Provide a custom FlashMapManager.handlerExceptionResolvers
(org.springframework.web.servlet.HandlerExceptionResolver... exceptionResolvers) Set the HandlerExceptionResolver types to use.interceptors
(org.springframework.web.servlet.HandlerInterceptor... interceptors) Add global interceptors.localeResolver
(org.springframework.web.servlet.LocaleResolver localeResolver) Provide the LocaleResolver to use.mappedInterceptors
(String[] pathPatterns, org.springframework.web.servlet.HandlerInterceptor... interceptors) Add interceptors for specific patterns.messageConverters
(org.springframework.http.converter.HttpMessageConverter<?>... messageConverters) Set the message converters to use.patternParser
(org.springframework.web.util.pattern.PathPatternParser parser) Enable URL path matching with parsedPathPatterns
.placeholderValue
(String name, String value) Configure placeholder values to use.singleView
(org.springframework.web.servlet.View view) Set up a singleViewResolver
with a fixed view.useTrailingSlashPatternMatch
(boolean useTrailingSlashPatternMatch) Deprecated.validator
(org.springframework.validation.Validator validator) Provide a customValidator
.viewResolvers
(org.springframework.web.servlet.ViewResolver... resolvers) Set up view resolution.Methods inherited from interface org.springframework.test.web.servlet.client.MockMvcWebTestClient.MockMvcServerSpec
alwaysExpect, apply, build, configureClient, defaultRequest, dispatcherServletCustomizer, dispatchOptions, filter, filters
-
Method Details
-
controllerAdvice
RegisterControllerAdvice
This is delegated to
StandaloneMockMvcBuilder.setControllerAdvice(Object...)
. -
messageConverters
MockMvcWebTestClient.ControllerSpec messageConverters(org.springframework.http.converter.HttpMessageConverter<?>... messageConverters) Set the message converters to use.This is delegated to
StandaloneMockMvcBuilder.setMessageConverters(HttpMessageConverter[])
. -
validator
Provide a customValidator
.This is delegated to
StandaloneMockMvcBuilder.setValidator(Validator)
. -
conversionService
MockMvcWebTestClient.ControllerSpec conversionService(org.springframework.format.support.FormattingConversionService conversionService) Provide a conversion service.This is delegated to
StandaloneMockMvcBuilder.setConversionService(FormattingConversionService)
. -
interceptors
MockMvcWebTestClient.ControllerSpec interceptors(org.springframework.web.servlet.HandlerInterceptor... interceptors) Add global interceptors.This is delegated to
StandaloneMockMvcBuilder.addInterceptors(HandlerInterceptor...)
. -
mappedInterceptors
MockMvcWebTestClient.ControllerSpec mappedInterceptors(@Nullable String[] pathPatterns, org.springframework.web.servlet.HandlerInterceptor... interceptors) Add interceptors for specific patterns.This is delegated to
StandaloneMockMvcBuilder.addMappedInterceptors(String[], HandlerInterceptor...)
. -
contentNegotiationManager
MockMvcWebTestClient.ControllerSpec contentNegotiationManager(org.springframework.web.accept.ContentNegotiationManager manager) Set a ContentNegotiationManager.This is delegated to
StandaloneMockMvcBuilder.setContentNegotiationManager(ContentNegotiationManager)
. -
asyncRequestTimeout
Specify the timeout value for async execution.This is delegated to
StandaloneMockMvcBuilder.setAsyncRequestTimeout(long)
. -
customArgumentResolvers
MockMvcWebTestClient.ControllerSpec customArgumentResolvers(org.springframework.web.method.support.HandlerMethodArgumentResolver... argumentResolvers) Provide custom argument resolvers.This is delegated to
StandaloneMockMvcBuilder.setCustomArgumentResolvers(HandlerMethodArgumentResolver...)
. -
customReturnValueHandlers
MockMvcWebTestClient.ControllerSpec customReturnValueHandlers(org.springframework.web.method.support.HandlerMethodReturnValueHandler... handlers) Provide custom return value handlers.This is delegated to
StandaloneMockMvcBuilder.setCustomReturnValueHandlers(HandlerMethodReturnValueHandler...)
. -
handlerExceptionResolvers
MockMvcWebTestClient.ControllerSpec handlerExceptionResolvers(org.springframework.web.servlet.HandlerExceptionResolver... exceptionResolvers) Set the HandlerExceptionResolver types to use.This is delegated to
StandaloneMockMvcBuilder.setHandlerExceptionResolvers(HandlerExceptionResolver...)
. -
viewResolvers
MockMvcWebTestClient.ControllerSpec viewResolvers(org.springframework.web.servlet.ViewResolver... resolvers) Set up view resolution.This is delegated to
StandaloneMockMvcBuilder.setViewResolvers(ViewResolver...)
. -
singleView
Set up a singleViewResolver
with a fixed view.This is delegated to
StandaloneMockMvcBuilder.setSingleView(View)
. -
localeResolver
MockMvcWebTestClient.ControllerSpec localeResolver(org.springframework.web.servlet.LocaleResolver localeResolver) Provide the LocaleResolver to use.This is delegated to
StandaloneMockMvcBuilder.setLocaleResolver(LocaleResolver)
. -
flashMapManager
MockMvcWebTestClient.ControllerSpec flashMapManager(org.springframework.web.servlet.FlashMapManager flashMapManager) Provide a custom FlashMapManager.This is delegated to
StandaloneMockMvcBuilder.setFlashMapManager(FlashMapManager)
. -
patternParser
MockMvcWebTestClient.ControllerSpec patternParser(org.springframework.web.util.pattern.PathPatternParser parser) Enable URL path matching with parsedPathPatterns
.This is delegated to
StandaloneMockMvcBuilder.setPatternParser(PathPatternParser)
. -
useTrailingSlashPatternMatch
@Deprecated(since="6.0") MockMvcWebTestClient.ControllerSpec useTrailingSlashPatternMatch(boolean useTrailingSlashPatternMatch) Deprecated.as of 6.0, seePathPatternParser.setMatchOptionalTrailingSeparator(boolean)
Whether to match trailing slashes.This is delegated to
StandaloneMockMvcBuilder.setUseTrailingSlashPatternMatch(boolean)
. -
placeholderValue
Configure placeholder values to use.This is delegated to
StandaloneMockMvcBuilder.addPlaceholderValue(String, String)
. -
customHandlerMapping
MockMvcWebTestClient.ControllerSpec customHandlerMapping(Supplier<org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping> factory) Configure factory for a customRequestMappingHandlerMapping
.This is delegated to
StandaloneMockMvcBuilder.setCustomHandlerMapping(Supplier)
.
-
PathPatternParser.setMatchOptionalTrailingSeparator(boolean)