Test that a response that is an array of primitives can be documented

Closes gh-96
This commit is contained in:
Andy Wilkinson
2015-07-22 15:06:29 +01:00
parent f481e2fc8a
commit b1a6840b52

View File

@@ -120,6 +120,18 @@ public class PayloadDocumentationTests {
fieldWithPath("[]a").description("three")).handle(result(response));
}
@Test
public void arrayResponse() throws IOException {
this.snippet.expectResponseFields("array-response").withContents( //
tableWithHeader("Path", "Type", "Description") //
.row("[]", "String", "one"));
MockHttpServletResponse response = new MockHttpServletResponse();
response.getWriter().append("[\"a\", \"b\", \"c\"]");
documentResponseFields("array-response", fieldWithPath("[]").description("one"))
.handle(result(response));
}
@Test
public void undocumentedRequestField() throws IOException {
this.thrown.expect(SnippetGenerationException.class);