@@ -0,0 +1,2809 @@
+/*%0A * Copyright 2015 Decebal Suiu%0A *%0A * Licensed under the Apache License, Version 2.0 (the 'License');%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an 'AS IS' BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.pf4j.util;%0A%0Aimport org.junit.jupiter.api.BeforeAll;%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport java.util.Arrays;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport static org.junit.jupiter.api.Assertions.assertEquals;%0A%0A/**%0A * @author Decebal Suiu%0A */%0Apublic class DirectedGraphTest %7B%0A%0A    private static DirectedGraph%3CCharacter%3E graph;%0A%0A    @BeforeAll%0A    public static void setUp() %7B%0A        graph = new DirectedGraph%3C%3E();%0A%0A        // add vertex%0A        graph.addVertex('A');%0A        graph.addVertex('B');%0A        graph.addVertex('C');%0A        graph.addVertex('D');%0A        graph.addVertex('E');%0A        graph.addVertex('F');%0A        graph.addVertex('G');%0A%0A        // add edges%0A        graph.addEdge('A', 'B');%0A        graph.addEdge('B', 'C');%0A        graph.addEdge('B', 'F');%0A        graph.addEdge('D', 'E');%0A        graph.addEdge('F', 'G');%0A    %7D%0A%0A    @Test%0A    public void reverseTopologicalSort() %7B%0A        List%3CCharacter%3E result = graph.reverseTopologicalSort();%0A        List%3CCharacter%3E expected = Arrays.asList('C', 'G', 'F', 'B', 'A', 'E', 'D');%0A        assertEquals(expected, result);%0A    %7D%0A%0A    @Test%0A    public void topologicalSort() %7B%0A        List%3CCharacter%3E result = graph.topologicalSort();%0A        List%3CCharacter%3E expected = Arrays.asList('D', 'E', 'A', 'B', 'F', 'G', 'C');%0A        assertEquals(expected, result);%0A    %7D%0A%0A    @Test%0A    public void inDegree() %7B%0A        Map%3CCharacter, Integer%3E result = graph.inDegree();%0A        Map%3CCharacter, Integer%3E expected = new HashMap%3C%3E(7);%0A        expected.put('A', 0);%0A        expected.put('B', 1);%0A        expected.put('C', 1);%0A        expected.put('D', 0);%0A        expected.put('E', 1);%0A        expected.put('F', 1);%0A        expected.put('G', 1);%0A        assertEquals(expected, result);%0A    %7D%0A%0A    @Test%0A    public void outDegree() %7B%0A        Map%3CCharacter, Integer%3E result = graph.outDegree();%0A        Map%3CCharacter, Integer%3E expected = new HashMap%3C%3E(7);%0A        expected.put('A', 1);%0A        expected.put('B', 2);%0A        expected.put('C', 0);%0A        expected.put('D', 1);%0A        expected.put('E', 0);%0A        expected.put('F', 1);%0A        expected.put('G', 0);%0A        assertEquals(expected, result);%0A    %7D%0A%0A%7D%0A

Add DirectedGraphTest