### Question:
ReachabilityIndex { public Set<Pair<Node, Node>> getConnectedPairs(Set<Node> sources, Set<Node> targets) { return evaluatePairs(sources, targets, new Predicate<Pair<Node, Node>>() { @Override public boolean apply(Pair<Node, Node> pair) { return canReach(pair.getLeft(), pair.getRight()); } }); } @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 testGetConnectedPairs() { Set<Node> src = newHashSet(a, d); Set<Node> dest = newHashSet(b, c); Set<Pair<Node, Node>> r = new HashSet<>(); r.add(Pair.of(a, b)); r.add(Pair.of(a, c)); Set<Pair<Node, Node>> result = index.getConnectedPairs(src, dest); assertThat(result, is(r)); }