CollectionResponse { protected CollectionResponse(Collection<T> items, String nextPageToken) { this.items = items; this.nextPageToken = nextPageToken; } protected  CollectionResponse(Collection<T> items, String nextPageToken); static Builder<T> builder(); String getNextPageToken(); Collection<T> getItems();  }
@Test public void testCollectionResponse() throws IOException { MockHttpServletResponse servletResponse = new MockHttpServletResponse(); ServletResponseResultWriter writer = new ServletResponseResultWriter(servletResponse, null); writer.write(getBeans(2)); ObjectNode json = new ObjectMapper().readValue( servletResponse.getContentAsString(), ObjectNode.class); assertThat(json.path("items")).hasSize(2); assertThat(json.path("nextPageToken").asText()).isEqualTo("next"); }