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 newRestDocumentationResultHandler
to be passed intoResultActions.andDo(ResultHandler)
that will produce documentation using the givensnippets
.protected final org.springframework.restdocs.generate.RestDocumentationGenerator<MockHttpServletRequest,
MockHttpServletResponse> Returns theRestDocumentationGenerator
that is used as a delegate.void
-
Method Details
-
handle
- Specified by:
handle
in interfaceResultHandler
-
document
public RestDocumentationResultHandler document(org.springframework.restdocs.snippet.Snippet... snippets) Creates a newRestDocumentationResultHandler
to 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 theRestDocumentationGenerator
that is used as a delegate.- Returns:
- the delegate
-