### Question:
ReverseEdgesCycleBreaker implements CycleBreaker { @Override public void breakCycle(final ReorderedGraph graph) { this.graph = (LayeredGraph) graph; for (final String vertex : this.graph.getVertices()) { visit(vertex); } } ReverseEdgesCycleBreaker(); @Override void breakCycle(final ReorderedGraph graph);  }### Answer:
@Test public void testAcyclicGraphs() { final LayeredGraph graph = new LayeredGraph(Graphs.SIMPLE_ACYCLIC); final ReverseEdgesCycleBreaker breaker = new ReverseEdgesCycleBreaker(); breaker.breakCycle(graph); assertTrue(graph.isAcyclic()); }
@Test public void testSimpleCyclicGraph() { final LayeredGraph graph = new LayeredGraph(Graphs.SIMPLE_CYCLIC); graph.addEdge("A", "B"); graph.addEdge("B", "C"); graph.addEdge("C", "D"); graph.addEdge("D", "A"); assertFalse(graph.isAcyclic()); final ReverseEdgesCycleBreaker breaker = new ReverseEdgesCycleBreaker(); breaker.breakCycle(graph); assertTrue(graph.isAcyclic()); }
@Test public void testCyclicGraph1() { final LayeredGraph graph = new LayeredGraph(Graphs.CYCLIC_GRAPH_1); final ReverseEdgesCycleBreaker breaker = new ReverseEdgesCycleBreaker(); breaker.breakCycle(graph); assertTrue(graph.isAcyclic()); }
@Test public void testCyclicGraphFull() { final LayeredGraph graph = new LayeredGraph(Graphs.Full); assertFalse(graph.isAcyclic()); final ReverseEdgesCycleBreaker breaker = new ReverseEdgesCycleBreaker(); breaker.breakCycle(graph); assertTrue(graph.isAcyclic()); }