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