diff --git a/spring-restdocs/src/test/java/org/springframework/restdocs/payload/PayloadDocumentationTests.java b/spring-restdocs/src/test/java/org/springframework/restdocs/payload/PayloadDocumentationTests.java index 7e99a145..c96afe0d 100644 --- a/spring-restdocs/src/test/java/org/springframework/restdocs/payload/PayloadDocumentationTests.java +++ b/spring-restdocs/src/test/java/org/springframework/restdocs/payload/PayloadDocumentationTests.java @@ -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);