Author: simonetripodi
Date: Tue Jun 21 18:58:06 2011
New Revision: 1138136

URL: http://svn.apache.org/viewvc?rev=1138136&view=rev
Log:
used directed only graph in Dijkstra's test

Modified:
    
commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/DijkstraTestCase.java

Modified: 
commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/DijkstraTestCase.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/DijkstraTestCase.java?rev=1138136&r1=1138135&r2=1138136&view=diff
==============================================================================
--- 
commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/DijkstraTestCase.java
 (original)
+++ 
commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/shortestpath/DijkstraTestCase.java
 Tue Jun 21 18:58:06 2011
@@ -3,14 +3,11 @@ package org.apache.commons.graph.shortes
 import static junit.framework.Assert.assertEquals;
 import static org.apache.commons.graph.shortestpath.Dijkstra.findShortestPath;
 
-import org.apache.commons.graph.MutableGraph;
 import org.apache.commons.graph.Path;
-import org.apache.commons.graph.WeightedGraph;
 import org.apache.commons.graph.model.BaseLabeledVertex;
 import org.apache.commons.graph.model.BaseLabeledWeightedEdge;
 import org.apache.commons.graph.model.DirectedMutableWeightedGraph;
 import org.apache.commons.graph.model.InMemoryWeightedPath;
-import org.apache.commons.graph.model.UndirectedMutableWeightedGraph;
 import org.junit.Test;
 
 public final class DijkstraTestCase
@@ -21,21 +18,10 @@ public final class DijkstraTestCase
      * Wikipedia {@link http://en.wikipedia.org/wiki/Dijkstra's_algorithm}
      */
     @Test
-    public void undirectedShortestPath()
+    public void findShortestPathAndVerify()
     {
-        findShortestPathAndVerify( new 
UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge>() );
-    }
-
-    @Test
-    public void directedShortestPath()
-    {
-        findShortestPathAndVerify( new 
DirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge>() );
-    }
-
-    private void findShortestPathAndVerify( WeightedGraph<BaseLabeledVertex, 
BaseLabeledWeightedEdge> weighted )
-    {
-        @SuppressWarnings( "unchecked" ) // mutable by definition, generic 
types driven by input arg
-        MutableGraph<BaseLabeledVertex, BaseLabeledWeightedEdge> mutable = 
(MutableGraph<BaseLabeledVertex, BaseLabeledWeightedEdge>) weighted;
+        DirectedMutableWeightedGraph<BaseLabeledVertex, 
BaseLabeledWeightedEdge> mutable =
+            new DirectedMutableWeightedGraph<BaseLabeledVertex, 
BaseLabeledWeightedEdge>();
 
         // building Graph
 
@@ -81,7 +67,7 @@ public final class DijkstraTestCase
 
         // actual path
 
-        Path<BaseLabeledVertex, BaseLabeledWeightedEdge> actual = 
findShortestPath( weighted, one, five );
+        Path<BaseLabeledVertex, BaseLabeledWeightedEdge> actual = 
findShortestPath( mutable, one, five );
 
         // assert!
 


Reply via email to