ExtractWalkEdgesFromHop extends KorypheFunction<Walk, Set<Edge>> { @Override public Set<Edge> apply(final Walk walk) { if (null == walk) { throw new IllegalArgumentException("Walk cannot be null"); } return walk.getEdges().get(hop); } ExtractWalkEdgesFromHop();  ExtractWalkEdgesFromHop(final int hop); int getHop(); void setHop(final int hop); @Override Set<Edge> apply(final Walk walk);  }
@Test public void shouldReturnEdgesFromWalkObject() { final Function<Walk, Set<Edge>> function = new ExtractWalkEdgesFromHop(1); final Walk walk = new Walk.Builder() .edge(EDGE_AB) .entity(ENTITY_B) .edge(EDGE_BC) .entity(ENTITY_C) .edge(EDGE_CA) .build(); final Set<Edge> results = function.apply(walk); assertThat(results, contains(EDGE_BC)); }