JsonApiRelationship { boolean containsEntity(JsonApiIdentifiable entity) { return data.stream() .anyMatch(id -> id.isSame(entity)); } 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 testContainsEntity() { JsonApiRelationship result = new JsonApiRelationship(relatedList, testLocation); Assert.assertTrue(result.containsEntity(dummy1)); Assert.assertTrue(result.containsEntity(anotherDummyClass)); Assert.assertFalse(result.containsEntity(dummy2)); }