JsonApiRelationship { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; JsonApiRelationship that = (JsonApiRelationship) o; return Objects.equals(data, that.data) && Objects.equals(links, that.links); } JsonApiRelationship(JsonApiIdentifiable entity, URI location);   JsonApiRelationship(Collection<? extends JsonApiIdentifiable> entityCollection, URI location); List<JsonApiIdentifiable> getData(); Map<String, URI> getLinks(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() { List<JsonApiIdentifiable> anotherList = Arrays.asList(dummy1, dummy2); JsonApiRelationship result1 = new JsonApiRelationship(relatedList, testLocation); JsonApiRelationship result2 = new JsonApiRelationship(relatedList, testLocation); JsonApiRelationship result3 = new JsonApiRelationship(relatedList, anotherLocation); JsonApiRelationship result4 = new JsonApiRelationship(anotherList, testLocation); Assert.assertTrue(result1.equals(result2)); Assert.assertFalse(result1.equals(result3)); Assert.assertFalse(result1.equals(result4)); Assert.assertFalse(result3.equals(result4)); }