public class RestDocumentationResultHandler
extends java.lang.Object
implements org.springframework.test.web.servlet.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<org.springframework.mock.web.MockHttpServletRequest,org.springframework.mock.web.MockHttpServletResponse> |
getDelegate()
Returns the
RestDocumentationGenerator that is used as a delegate. |
void |
handle(org.springframework.test.web.servlet.MvcResult result) |
public void handle(org.springframework.test.web.servlet.MvcResult result)
throws java.lang.Exception
handle in interface org.springframework.test.web.servlet.ResultHandlerjava.lang.Exceptionpublic 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<org.springframework.mock.web.MockHttpServletRequest,org.springframework.mock.web.MockHttpServletResponse> getDelegate()
RestDocumentationGenerator that is used as a delegate.