### Question:
ReachabilityIndex { public boolean allReachable(Set<Node> sources, Set<Node> targets) { for (Node source : sources) { for (Node target : targets) { if (!canReach(source, target)) { return false; } } } return true; } @Inject  ReachabilityIndex(GraphDatabaseService graphDb); boolean indexExists(); void createIndex(); void setTransactionBatchSize(int size); void createIndex(Predicate<Node> nodePredicate); void dropIndex(); boolean canReach(Node startNode, Node endNode); Set<Pair<Node, Node>> getConnectedPairs(Set<Node> sources, Set<Node> targets); Set<Pair<Node, Node>> getDisconnectedPairs(Set<Node> sources, Set<Node> targets); boolean allReachable(Set<Node> sources, Set<Node> targets);  }### Answer:
@Test public void testAllReachable() { Set<Node> dest = newHashSet(b, c); assertThat(index.allReachable(newHashSet(a), dest), is(true)); dest.add(d); assertThat(index.allReachable(newHashSet(a), dest), is(false)); Set<Node> src = newHashSet(a, c); assertThat(index.allReachable(src, newHashSet(c)), is(true)); src.add(b); assertThat(index.allReachable(src, newHashSet(c)), is(false)); }