### Question:
SpelRelationshipInclusionPolicy extends SpelInclusionPolicy implements RelationshipInclusionPolicy { @Override public boolean include(Relationship relationship) { return (Boolean) exp.getValue(new AttachedRelationship(relationship)); } SpelRelationshipInclusionPolicy(String expression); @Override boolean include(Relationship relationship); @Override boolean include(Relationship relationship, Node pointOfView); @Override Iterable<Relationship> getAll(GraphDatabaseService database);  }### Answer:
@Test public void shouldIncludeCorrectRelationships() { try (Transaction tx = database.beginTx()) { assertTrue(policy1.include(michalWorksFor())); assertTrue(policy1.include(vojtaWorksFor())); assertFalse(policy1.include(michalLivesIn())); assertFalse(policy1.include(vojtaLivesIn())); assertTrue(policy2.include(michalWorksFor())); assertTrue(policy2.include(vojtaWorksFor())); assertFalse(policy2.include(michalLivesIn())); assertFalse(policy2.include(vojtaLivesIn())); assertTrue(policy7.include(michalWorksFor())); assertTrue(policy7.include(vojtaWorksFor())); assertFalse(policy7.include(michalLivesIn())); assertFalse(policy7.include(vojtaLivesIn())); assertTrue(policy3.include(michalLivesIn(), london())); assertFalse(policy3.include(michalLivesIn(), michal())); assertTrue(policy3.include(vojtaLivesIn(), london())); assertFalse(policy3.include(vojtaLivesIn(), vojta())); assertFalse(policy3.include(michalWorksFor(), michal())); assertFalse(policy3.include(michalWorksFor(), graphaware())); assertTrue(policy4.include(michalLivesIn(), michal())); assertTrue(policy4.include(michalLivesIn(), london())); assertTrue(policy4.include(michalWorksFor(), michal())); assertTrue(policy4.include(michalWorksFor(), graphaware())); assertFalse(policy4.include(vojtaLivesIn(), london())); assertFalse(policy4.include(vojtaLivesIn(), vojta())); assertTrue(policy4.include(michalLivesIn())); assertTrue(policy4.include(michalWorksFor())); assertFalse(policy4.include(vojtaLivesIn())); assertFalse(policy5.include(michalLivesIn(), michal())); assertTrue(policy5.include(michalLivesIn(), london())); assertFalse(policy5.include(michalWorksFor(), michal())); assertTrue(policy5.include(michalWorksFor(), graphaware())); assertFalse(policy5.include(vojtaLivesIn(), london())); assertFalse(policy5.include(vojtaLivesIn(), vojta())); assertFalse(policy6.include(michalLivesIn())); assertFalse(policy6.include(michalWorksFor())); assertFalse(policy6.include(vojtaLivesIn())); assertTrue(policy6.include(vojtaWorksFor())); tx.success(); } }
@Test(expected = Exception.class) public void shouldComplainAboutIncorrectUsage1() { try (Transaction tx = database.beginTx()) { policy5.include(michalLivesIn(), vojta()); tx.success(); } }
@Test(expected = Exception.class) public void shouldComplainAboutIncorrectUsage2() { try (Transaction tx = database.beginTx()) { policy3.include(michalLivesIn()); tx.success(); } }
@Test(expected = Exception.class) public void shouldComplainAboutIncorrectUsage3() { try (Transaction tx = database.beginTx()) { policy5.include(michalLivesIn()); tx.success(); } }