public class RestDocumentationResultHandler extends Object implements ResultHandler
ResultHandler for documenting RESTful APIs.MockMvcRestDocumentation.document(String, Snippet...)| Modifier and Type | Method and Description |
|---|---|
RestDocumentationResultHandler |
document(Snippet... snippets)
Creates a new
RestDocumentationResultHandler to be passed into
ResultActions.andDo(ResultHandler) that will produce documentation using
the given snippets. |
protected RestDocumentationGenerator<MockHttpServletRequest,MockHttpServletResponse> |
getDelegate()
Returns the
RestDocumentationGenerator that is used as a delegate. |
void |
handle(MvcResult result) |
public void handle(MvcResult result) throws Exception
handle in interface ResultHandlerExceptionpublic RestDocumentationResultHandler document(Snippet... snippets)
RestDocumentationResultHandler to be passed into
ResultActions.andDo(ResultHandler) that will produce documentation using
the given snippets. For example:
this.mockMvc.perform(MockMvcRequestBuilders.get("/search"))
.andExpect(status().isOk())
.andDo(this.documentationHandler.document(responseFields(
fieldWithPath("page").description("The requested Page")
));
snippets - the snippetsprotected final RestDocumentationGenerator<MockHttpServletRequest,MockHttpServletResponse> getDelegate()
RestDocumentationGenerator that is used as a delegate.