@@ -0,0 +1,1687 @@
+package com.test.graphs;%0A%0Aimport com.graphs.DetectCycle;%0Aimport com.graphs.GraphAdjacencyListRepresentation;%0A%0Aimport junit.framework.TestCase;%0A%0Apublic class TestDetectCycle extends TestCase %7B%0A%0A    public void testConnectedComponentsInDirectedGraph() %7B%0A        GraphAdjacencyListRepresentation graph = new GraphAdjacencyListRepresentation(13, true);%0A%0A        graph.addEdge(0, 5);%0A        graph.addEdge(0, 1);%0A%0A        graph.addEdge(2, 0);%0A        graph.addEdge(2, 3);%0A%0A        graph.addEdge(3, 5);%0A        graph.addEdge(3, 2);%0A%0A        graph.addEdge(4, 3);%0A        graph.addEdge(4, 2);%0A%0A        graph.addEdge(5, 4);%0A%0A        graph.addEdge(6, 9);%0A        graph.addEdge(6, 4);%0A        graph.addEdge(6, 8);%0A        graph.addEdge(6, 0);%0A%0A        graph.addEdge(7, 6);%0A        graph.addEdge(7, 9);%0A%0A        graph.addEdge(8, 6);%0A%0A        graph.addEdge(9, 11);%0A        graph.addEdge(9, 10);%0A%0A        graph.addEdge(10, 12);%0A%0A        graph.addEdge(11, 4);%0A        graph.addEdge(11, 12);%0A%0A        graph.addEdge(12, 9);%0A        %0A        assertEquals(true, DetectCycle.haveCycle(graph));%0A        %0A        %0A        graph = new GraphAdjacencyListRepresentation(13, true);%0A%0A        graph.addEdge(0, 5);%0A        graph.addEdge(0, 1);%0A        graph.addEdge(0, 6);%0A%0A        graph.addEdge(2, 0);%0A        graph.addEdge(2, 3);%0A%0A        graph.addEdge(3, 5);%0A%0A        graph.addEdge(5, 4);%0A%0A        graph.addEdge(6, 9);%0A        graph.addEdge(6, 4);%0A%0A        graph.addEdge(7, 6);%0A%0A        graph.addEdge(8, 7);%0A%0A        graph.addEdge(9, 11);%0A        graph.addEdge(9, 10);%0A        graph.addEdge(9, 12);%0A%0A        graph.addEdge(11, 12);%0A%0A        assertEquals(false, DetectCycle.haveCycle(graph));%0A        %0A    %7D%0A    %0A%7D%0A

Add JUnit test for DetectCycle