Update the README to reflect the changes to how document is used

This commit is contained in:
Andy Wilkinson
2014-12-02 12:20:08 +00:00
parent ff7119ec54
commit 23e8ad3dae

View File

@@ -91,11 +91,14 @@ public void setUp() {
The default values are `http`, `localhost`, and `8080`. You can omit the above
configuration if these defaults meet your needs.
To document a MockMvc call, wrap it in a call to `RestDocumentation.document`:
To document a MockMvc call, you use MockMvc's `andDo` method, passing it a
`RestDocumentationResultHandler` that can be easily obtained from
the static `RestDocumentation.document` method:
```java
public void getIndex() {
document("index", this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON)));
this.mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON))
.andDo(document("index"));
}
```