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 givenidentifierusing the givensnippetsin addition to any default snippets.document(String identifier, OperationRequestPreprocessor requestPreprocessor, Snippet... snippets) Documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets.document(String identifier, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets.Documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets.documentationConfiguration(RestDocumentationContextProvider contextProvider) Provides access to aMockMvcConfigurerthat can be used to configure aMockMvcinstance using the givencontextProvider.
-
Method Details
-
documentationConfiguration
public static MockMvcRestDocumentationConfigurer documentationConfiguration(RestDocumentationContextProvider contextProvider) Provides access to aMockMvcConfigurerthat can be used to configure aMockMvcinstance using the givencontextProvider.- Parameters:
contextProvider- the context provider- Returns:
- the configurer
- See Also:
-
ConfigurableMockMvcBuilder.apply(MockMvcConfigurer)
-
document
Documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets.- Parameters:
identifier- an identifier for the API call that is being documentedsnippets- the snippets- Returns:
- a Mock MVC
ResultHandlerthat 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 givenidentifierusing the givensnippetsin addition to any default snippets. The givenrequestPreprocessoris 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
ResultHandlerthat 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 givenidentifierusing the givensnippetsin addition to any default snippets. The givenresponsePreprocessoris 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
ResultHandlerthat 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 givenidentifierusing the givensnippetsin addition to any default snippets. The givenrequestPreprocessorandresponsePreprocessorare 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
ResultHandlerthat will produce the documentation - See Also:
-
MockMvc.perform(org.springframework.test.web.servlet.RequestBuilder)ResultActions.andDo(org.springframework.test.web.servlet.ResultHandler)
-