JsonApiDocument implements Serializable, JsonLinks { @JsonInclude(JsonInclude.Include.NON_NULL) public JsonApiData getData() { return data; } JsonApiDocument(JsonApiError error);  JsonApiDocument(JsonApiIdentifiable entity,
						   UriInfo uriInfo);  JsonApiDocument(Collection<? extends JsonApiIdentifiable> entityCollection,
						   UriInfo uriInfo); void setResourceCollectionURI(URI collectionURI); @JsonInclude(JsonInclude.Include.NON_NULL) JsonApiData getData(); @JsonInclude(JsonInclude.Include.NON_NULL) List<JsonApiError> getErrors(); @JsonInclude(JsonInclude.Include.NON_EMPTY) List<JsonApiResource> getIncluded(); boolean hasRelationshipTo(JsonApiIdentifiable entity); void restrictTo(String attribute); void addRelationship(String name, JsonApiIdentifiable entity, URI location); void addRelationship(String name, Collection<? extends JsonApiIdentifiable> entity, URI location); void addIncluded(JsonApiIdentifiable entity); @Override Map<String, URI> getLinks(); @Override void addLink(String name, URI ref); @Override URI getURI(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testConstructorWithEntity() { setUpUriInfo(); JsonApiDocument result = new JsonApiDocument(dummyObj01, uriInfoMock); JsonApiData data = result.getData(); Assert.assertTrue(data instanceof JsonApiResource); Assert.assertEquals(dummyObj01, data.asSingleResource().getEntity()); }
@Test public void testConstructorWithCollection() { setUpUriInfo(); List<JsonApiIdentifiable> dummyCollection = Arrays.asList(dummyObj01, dummyObj42, dummyObj43); JsonApiDocument result = new JsonApiDocument(dummyCollection, uriInfoMock); Assert.assertEquals( dummyCollection, result .getData() .asResourceCollection() .getEntity() .stream() .map(JsonApiResource::getEntity) .collect(Collectors.toList())); }