### Question:
GraphWalk implements GraphPath<V, E> { public GraphWalk<V, E> reverse() { return this.reverse(null); } GraphWalk(Graph<V, E> graph, V startVertex, V endVertex, List<E> edgeList, double weight);  GraphWalk(Graph<V, E> graph, List<V> vertexList, double weight);  GraphWalk(
        Graph<V, E> graph, V startVertex, V endVertex, List<V> vertexList, List<E> edgeList,
        double weight); @Override Graph<V, E> getGraph(); @Override V getStartVertex(); @Override V getEndVertex(); @Override List<E> getEdgeList(); @Override List<V> getVertexList(); @Override double getWeight(); void setWeight(double weight); @Override int getLength(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); GraphWalk<V, E> reverse(); GraphWalk<V, E> reverse(Function<GraphWalk<V, E>, Double> walkWeightCalculator); GraphWalk<V, E> concat(
        GraphWalk<V, E> extension, Function<GraphWalk<V, E>, Double> walkWeightCalculator); boolean isEmpty(); void verify(); static GraphWalk<V, E> emptyWalk(Graph<V, E> graph); static GraphWalk<V, E> singletonWalk(Graph<V, E> graph, V v); static GraphWalk<V, E> singletonWalk(Graph<V, E> graph, V v, double weight);  }### Answer:
@Test(expected = InvalidGraphWalkException.class) public void testReverseInvalidPathDirected() { Graph<Integer, DefaultEdge> graph = new SimpleDirectedGraph<>(DefaultEdge.class); Graphs.addAllVertices(graph, Arrays.asList(0, 1, 2, 3)); graph.addEdge(0, 1); graph.addEdge(1, 2); graph.addEdge(2, 3); GraphWalk<Integer, DefaultEdge> gw1 = new GraphWalk<>(graph, 0, 3, Arrays.asList(0, 1, 2, 3), null, 0); gw1.reverse(gw -> gw.edgeList.stream().mapToDouble(gw.graph::getEdgeWeight).sum()); }