Test that a response that is an array of primitives can be documented
Closes gh-96
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user