@@ -0,0 +1,2295 @@
+package algorithms.graph;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.junit.After;%0Aimport org.junit.AfterClass;%0Aimport org.junit.Before;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0A%0Aimport algorithms.util.InputUtil;%0A%0Apublic class TestDetectCycleDirectedGraph %7B%0A  private static final String basePath = %22input_files/graph/detect_cycle/%22;%0A  private static String%5B%5D testCases = new String%5B%5D %7B %22test_case_1%22, %22test_case_2%22, %22test_case_3%22, %22test_case_4%22,%0A      %22test_case_5%22 %7D;%0A  private static List%3CString%5B%5D%3E inputList = new ArrayList%3CString%5B%5D%3E();%0A  private DetectCycleDirectedGraph detectCycleDirectedGraph = null;%0A%0A  @BeforeClass%0A  public static void setup() %7B%0A    for (String testCase : testCases) %7B%0A      String inputFile = basePath + testCase;%0A      inputList.add(InputUtil.readContents(inputFile));%0A    %7D%0A  %7D%0A%0A  @AfterClass%0A  public static void teardown() %7B%0A    testCases = null;%0A    inputList = null;%0A  %7D%0A%0A  @Before%0A  public void setupTest() %7B%0A    detectCycleDirectedGraph = new DetectCycleDirectedGraph();%0A  %7D%0A%0A  @After%0A  public void tearDownTest() %7B%0A    detectCycleDirectedGraph = null;%0A  %7D%0A%0A  @Test%0A  public void testDetectCycleDirectedGraphTestCase1() %7B%0A    String%5B%5D input = inputList.get(0);%0A    detectCycleDirectedGraph.constructGraph(input);%0A    assertEquals(true, detectCycleDirectedGraph.detectCycle());%0A  %7D%0A%0A  @Test%0A  public void testDetectCycleDirectedGraphTestCase2() %7B%0A    String%5B%5D input = inputList.get(1);%0A    detectCycleDirectedGraph.constructGraph(input);%0A    assertEquals(false, detectCycleDirectedGraph.detectCycle());%0A  %7D%0A%0A  @Test%0A  public void testDetectCycleDirectedGraphTestCase3() %7B%0A    String%5B%5D input = inputList.get(2);%0A    detectCycleDirectedGraph.constructGraph(input);%0A    assertEquals(true, detectCycleDirectedGraph.detectCycle());%0A  %7D%0A%0A  @Test%0A  public void testDetectCycleDirectedGraphTestCase4() %7B%0A    String%5B%5D input = inputList.get(3);%0A    detectCycleDirectedGraph.constructGraph(input);%0A    assertEquals(false, detectCycleDirectedGraph.detectCycle());%0A  %7D%0A%0A  @Test%0A  public void testDetectCycleDirectedGraphTestCase5() %7B%0A    String%5B%5D input = inputList.get(4);%0A    detectCycleDirectedGraph.constructGraph(input);%0A    assertEquals(true, detectCycleDirectedGraph.detectCycle());%0A  %7D%0A%7D%0A

Add test class TestDetectCycleDirectedGraph