Class MockMvcRestDocumentation
java.lang.Object
org.springframework.restdocs.mockmvc.MockMvcRestDocumentation
Static factory methods for documenting RESTful APIs using Spring MVC Test.
- Author:
- Andy Wilkinson
-
Method Summary
Modifier and TypeMethodDescriptiondocument
(String identifier, OperationRequestPreprocessor requestPreprocessor, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets.document
(String identifier, OperationRequestPreprocessor requestPreprocessor, Snippet... snippets) Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets.document
(String identifier, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets.Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets.documentationConfiguration
(RestDocumentationContextProvider contextProvider) Provides access to aMockMvcConfigurer
that can be used to configure aMockMvc
instance using the givencontextProvider
.
-
Method Details
-
documentationConfiguration
public static MockMvcRestDocumentationConfigurer documentationConfiguration(RestDocumentationContextProvider contextProvider) Provides access to aMockMvcConfigurer
that can be used to configure aMockMvc
instance using the givencontextProvider
.- Parameters:
contextProvider
- the context provider- Returns:
- the configurer
- See Also:
-
ConfigurableMockMvcBuilder.apply(MockMvcConfigurer)
-
document
Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets.- Parameters:
identifier
- an identifier for the API call that is being documentedsnippets
- the snippets- Returns:
- a Mock MVC
ResultHandler
that will produce the documentation - See Also:
-
MockMvc.perform(org.springframework.test.web.servlet.RequestBuilder)
ResultActions.andDo(org.springframework.test.web.servlet.ResultHandler)
-
document
public static RestDocumentationResultHandler document(String identifier, OperationRequestPreprocessor requestPreprocessor, Snippet... snippets) Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets. The givenrequestPreprocessor
is applied to the request before it is documented.- Parameters:
identifier
- an identifier for the API call that is being documentedrequestPreprocessor
- the request preprocessorsnippets
- the snippets- Returns:
- a Mock MVC
ResultHandler
that will produce the documentation - See Also:
-
MockMvc.perform(org.springframework.test.web.servlet.RequestBuilder)
ResultActions.andDo(org.springframework.test.web.servlet.ResultHandler)
-
document
public static RestDocumentationResultHandler document(String identifier, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets. The givenresponsePreprocessor
is applied to the request before it is documented.- Parameters:
identifier
- an identifier for the API call that is being documentedresponsePreprocessor
- the response preprocessorsnippets
- the snippets- Returns:
- a Mock MVC
ResultHandler
that will produce the documentation - See Also:
-
MockMvc.perform(org.springframework.test.web.servlet.RequestBuilder)
ResultActions.andDo(org.springframework.test.web.servlet.ResultHandler)
-
document
public static RestDocumentationResultHandler document(String identifier, OperationRequestPreprocessor requestPreprocessor, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifier
using the givensnippets
in addition to any default snippets. The givenrequestPreprocessor
andresponsePreprocessor
are applied to the request and response respectively before they are documented.- Parameters:
identifier
- an identifier for the API call that is being documentedrequestPreprocessor
- the request preprocessorresponsePreprocessor
- the response preprocessorsnippets
- the snippets- Returns:
- a Mock MVC
ResultHandler
that will produce the documentation - See Also:
-
MockMvc.perform(org.springframework.test.web.servlet.RequestBuilder)
ResultActions.andDo(org.springframework.test.web.servlet.ResultHandler)
-