Commit Graph

3 Commits

Author SHA1 Message Date
Andy Wilkinson
d5afc5d6f2 Update the README to reflect new functionality 2014-10-23 13:43:19 +01:00
Andy Wilkinson
c823296db0 Remove the need for manual documentCurlRequest/Response calls
Previously, whenever a MockMvc perform call was made and the request
and response were to be documented, calls to documentCurlRequest and
documentCurlResponse had to be made.

This commit updates the REST documentation framework to make the
documentation of the request and response automatic. It makes use of
MockMvc’s MockMvcConfigurer that was introduced in Spring 4.1. Applying
RestDocumentationConfiguration once will cause all requests and
responses to be documented:

this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
		.apply(new RestDocumentationConfiguration()).build();

The path to which the requests and response documentation snippets will
be written is determined by the class and method in which the MockMvc
perform call is made and is currently of the form
shortClassName/methodName(Request|Response|RequestResponse).asciidoc
where shortClassName is the name of the documentation class without its
package. This works for both @Test methods and any non-private methods
that are called from the test method. The methods must be non-private as
a CGLib proxy is used to intercept the calls and configure the output
path.
2014-10-23 11:37:24 +01:00
Andy Wilkinson
b7904bcad7 Initial commit 2014-10-08 14:04:52 +01:00