JsonApiResource extends JsonApiResourceIdentifier implements JsonLinks, JsonApiData { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; JsonApiResource that = (JsonApiResource) o; return Objects.equals(uri, that.uri) && Objects.equals(entity, that.entity); } JsonApiResource(JsonApiIdentifiable entity, URI uri); @JsonIgnoreProperties(value = {"id", "type"}) @JsonProperty("attributes") Object getEntity(); @JsonInclude(JsonInclude.Include.NON_EMPTY) Map<String, JsonApiRelationship> getRelationships(); @Override Map<String, URI> getLinks(); @Override void addLink(String name, URI ref); @Override URI getURI(); @Override boolean hasRelationshipTo(JsonApiIdentifiable related); @Override void setResourceCollectionURI(URI collectionURI); @Override JsonApiResource asSingleResource(); @Override JsonApiResourceCollection asResourceCollection(); @Override URI getRelationshipUri(JsonApiIdentifiable related); @Override JsonApiResource addRelationship(String name, JsonApiIdentifiable related, URI location); @Override JsonApiResource addRelationship(String name, Collection<? extends JsonApiIdentifiable> relatedCollection, URI location); @Override JsonApiResource restrictTo(String attribute); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() { JsonApiResource result1 = new JsonApiResource(dummyObj,uri); JsonApiResource result2 = new JsonApiResource(dummyObj,uri); JsonApiResource resultOther = new JsonApiResource(new Dummy("x"), uri); Assert.assertEquals(result1, result2); Assert.assertNotEquals(resultOther, result1); }