DefaultHttpJsonResponse implements HttpJsonResponse { @Override public <T> List<T> asList(Class<T> dtoInterface) { requireNonNull(dtoInterface, "Required non-null dto interface"); return DtoFactory.getInstance().createListDtoFromJson(responseBody, dtoInterface); } DefaultHttpJsonResponse(String response, int responseCode); @Override String asString(); @Override T asDto(Class<T> dtoInterface); @Override List<T> asList(Class<T> dtoInterface); @Override @SuppressWarnings("unchecked") Map<String, String> asProperties(); @Override T as(Class<T> clazz, Type genericType); @Override int getResponseCode();  }
@Test public void shouldBeAbleToRequestListOfJsonSerializableElements() throws Exception { final Link testLink = createLink("POST", "http: final String responseBody = DtoFactory.getInstance().toJson(new JsonArrayImpl<>(singletonList(testLink))); final DefaultHttpJsonResponse response = new DefaultHttpJsonResponse(responseBody, 200); assertEquals(response.asList(Link.class), singletonList(testLink)); }