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) |
RestDocumentationResultHandler |
snippets(Snippet... snippets)
Deprecated.
since 1.1 in favor of
document(Snippet...) and passing the
return value into ResultActions.andDo(ResultHandler) |
public void handle(org.springframework.test.web.servlet.MvcResult result) throws java.lang.Exception
handle
in interface org.springframework.test.web.servlet.ResultHandler
java.lang.Exception
@Deprecated public RestDocumentationResultHandler snippets(Snippet... snippets)
document(Snippet...)
and passing the
return value into ResultActions.andDo(ResultHandler)
snippets
such that they are documented when this result
handler is called.snippets
- the snippets to addRestDocumentationResultHandler
public 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.