Class RestDocumentationResultHandler
java.lang.Object
org.springframework.restdocs.mockmvc.RestDocumentationResultHandler
- All Implemented Interfaces:
ResultHandler
A Spring MVC Test
ResultHandler for documenting RESTful APIs.- Author:
- Andy Wilkinson, Andreas Evers
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondocument(org.springframework.restdocs.snippet.Snippet... snippets) Creates a newRestDocumentationResultHandlerto be passed intoResultActions.andDo(ResultHandler)that will produce documentation using the givensnippets.protected final org.springframework.restdocs.generate.RestDocumentationGenerator<MockHttpServletRequest,MockHttpServletResponse> Returns theRestDocumentationGeneratorthat is used as a delegate.void
-
Method Details
-
handle
- Specified by:
handlein interfaceResultHandler
-
document
public RestDocumentationResultHandler document(org.springframework.restdocs.snippet.Snippet... snippets) Creates a newRestDocumentationResultHandlerto be passed intoResultActions.andDo(ResultHandler)that will produce documentation using the givensnippets. For example:this.mockMvc.perform(MockMvcRequestBuilders.get("/search")) .andExpect(status().isOk()) .andDo(this.documentationHandler.document(responseFields( fieldWithPath("page").description("The requested Page") ));- Parameters:
snippets- the snippets- Returns:
- the new result handler
-
getDelegate
protected final org.springframework.restdocs.generate.RestDocumentationGenerator<MockHttpServletRequest,MockHttpServletResponse> getDelegate()Returns theRestDocumentationGeneratorthat is used as a delegate.- Returns:
- the delegate
-