commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marcospera...@apache.org
Subject svn commit: r1290857 - in /commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph: flow/FordFulkersonTestCase.java spanning/BoruvkaTestCase.java spanning/KruskalTestCase.java spanning/PrimTestCase.java spanning/ReverseDeleteTestCase.java
Date Sat, 18 Feb 2012 20:22:37 GMT
Author: marcosperanza
Date: Sat Feb 18 20:22:36 2012
New Revision: 1290857

URL: http://svn.apache.org/viewvc?rev=1290857&view=rev
Log:
Removed unnecessary graph population

Modified:
    commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java
    commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/BoruvkaTestCase.java
    commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/KruskalTestCase.java
    commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/PrimTestCase.java
    commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/ReverseDeleteTestCase.java

Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java?rev=1290857&r1=1290856&r2=1290857&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java
(original)
+++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java
Sat Feb 18 20:22:36 2012
@@ -133,16 +133,6 @@ public final class FordFulkersonTestCase
                     @Override
                     public void connect()
                     {
-                        BaseLabeledVertex a = addVertex( new BaseLabeledVertex( "A" ) );
-                        BaseLabeledVertex b = addVertex( new BaseLabeledVertex( "B" ) );
-                        BaseLabeledVertex c = addVertex( new BaseLabeledVertex( "C" ) );
-                        BaseLabeledVertex d = addVertex( new BaseLabeledVertex( "D" ) );
-
-                        addEdge( new BaseLabeledWeightedEdge<Integer>( "A -> B",
1000 ) ).from( a ).to( b );
-                        addEdge( new BaseLabeledWeightedEdge<Integer>( "A -> C",
1000 ) ).from( a ).to( c );
-                        addEdge( new BaseLabeledWeightedEdge<Integer>( "B -> C",
1 ) ).from( b ).to( c );
-                        addEdge( new BaseLabeledWeightedEdge<Integer>( "B -> D",
1000 ) ).from( b ).to( d );
-                        addEdge( new BaseLabeledWeightedEdge<Integer>( "C -> D",
1000 ) ).from( c ).to( d );
                     }
 
                 } );

Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/BoruvkaTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/BoruvkaTestCase.java?rev=1290857&r1=1290856&r2=1290857&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/BoruvkaTestCase.java
(original)
+++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/BoruvkaTestCase.java
Sat Feb 18 20:22:36 2012
@@ -20,8 +20,6 @@ package org.apache.commons.graph.spannin
  */
 
 import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.fail;
-
 import static org.apache.commons.graph.CommonsGraph.minimumSpanningTree;
 
 import org.apache.commons.graph.SpanningTree;
@@ -47,42 +45,17 @@ public final class BoruvkaTestCase
     @Test( expected = NullPointerException.class )
     public void testNullVertex()
     {
-        UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input = null;
-        try
-        {
-            input = new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
-            input.addVertex( new BaseLabeledVertex( "A" ) );
-        }
-        catch ( NullPointerException e )
-        {
-            fail( e.getMessage() );
-        }
-
+        UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input =
+            new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
         minimumSpanningTree( input ).fromSource( null ).applyingBoruvkaAlgorithm( new DoubleWeight()
);
     }
 
     @Test( expected = NullPointerException.class )
     public void testNullMonoid()
     {
-        UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input = null;
-        BaseLabeledVertex a = null;
-        try
-        {
-            input = new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
-            a = new BaseLabeledVertex( "A" );
-            BaseLabeledVertex b = new BaseLabeledVertex( "B" );
-
-            input.addVertex( a );
-            input.addVertex( b );
-
-            input.addEdge( a, new BaseLabeledWeightedEdge<Double>( "a <-> b",
7D ), b );
-        }
-        catch ( NullPointerException e )
-        {
-            fail( e.getMessage() );
-        }
-
-        minimumSpanningTree( input ).fromSource( a ).applyingBoruvkaAlgorithm( null );
+        UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input =
+            new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
+        minimumSpanningTree( input ).fromSource( new BaseLabeledVertex( "A" ) ).applyingBoruvkaAlgorithm(
null );
     }
     
     @Test( expected = IllegalStateException.class )

Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/KruskalTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/KruskalTestCase.java?rev=1290857&r1=1290856&r2=1290857&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/KruskalTestCase.java
(original)
+++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/KruskalTestCase.java
Sat Feb 18 20:22:36 2012
@@ -20,7 +20,6 @@ package org.apache.commons.graph.spannin
  */
 
 import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.fail;
 import static org.apache.commons.graph.CommonsGraph.minimumSpanningTree;
 
 import org.apache.commons.graph.SpanningTree;
@@ -46,42 +45,18 @@ public final class KruskalTestCase
     @Test( expected = NullPointerException.class )
     public void testNullVertex()
     {
-        UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input = null;
-        try
-        {
-            input = new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
-            input.addVertex( new BaseLabeledVertex( "A" ) );
-        }
-        catch ( NullPointerException e )
-        {
-            fail( e.getMessage() );
-        }
-
+        UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input =
+            new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
         minimumSpanningTree( input ).fromSource( null ).applyingKruskalAlgorithm( new DoubleWeight()
);
     }
 
     @Test( expected = NullPointerException.class )
     public void testNullMonoid()
     {
-        UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input = null;
-        BaseLabeledVertex a = null;
-        try
-        {
-            input = new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
-            a = new BaseLabeledVertex( "A" );
-            BaseLabeledVertex b = new BaseLabeledVertex( "B" );
-
-            input.addVertex( a );
-            input.addVertex( b );
-
-            input.addEdge( a, new BaseLabeledWeightedEdge<Double>( "a <-> b",
7D ), b );
-        }
-        catch ( NullPointerException e )
-        {
-            fail( e.getMessage() );
-        }
+        UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input =
+            new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
 
-        minimumSpanningTree( input ).fromSource( a ).applyingKruskalAlgorithm( null );
+        minimumSpanningTree( input ).fromSource( new BaseLabeledVertex( "A" ) ).applyingKruskalAlgorithm(
null );
     }
     
     @Test( expected = IllegalStateException.class )

Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/PrimTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/PrimTestCase.java?rev=1290857&r1=1290856&r2=1290857&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/PrimTestCase.java
(original)
+++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/PrimTestCase.java
Sat Feb 18 20:22:36 2012
@@ -20,7 +20,6 @@ package org.apache.commons.graph.spannin
  */
 
 import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.fail;
 import static org.apache.commons.graph.CommonsGraph.minimumSpanningTree;
 
 import org.apache.commons.graph.SpanningTree;
@@ -45,16 +44,8 @@ public final class PrimTestCase
     @Test( expected = NullPointerException.class )
     public void testNullVertex()
     {
-        UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input = null;
-        try
-        {
-            input = new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
-            input.addVertex( new BaseLabeledVertex( "A" ) );
-        }
-        catch ( NullPointerException e )
-        {
-            fail( e.getMessage() );
-        }
+        UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input =
+            new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
 
         minimumSpanningTree( input ).fromSource( null ).applyingPrimAlgorithm( new DoubleWeight()
);
     }
@@ -62,25 +53,10 @@ public final class PrimTestCase
     @Test( expected = NullPointerException.class )
     public void testNullMonoid()
     {
-        UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input = null;
-        BaseLabeledVertex a = null;
-        try
-        {
-            input = new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
-            a = new BaseLabeledVertex( "A" );
-            BaseLabeledVertex b = new BaseLabeledVertex( "B" );
-
-            input.addVertex( a );
-            input.addVertex( b );
-
-            input.addEdge( a, new BaseLabeledWeightedEdge<Double>( "a <-> b",
7D ), b );
-        }
-        catch ( NullPointerException e )
-        {
-            fail( e.getMessage() );
-        }
+        UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input =
+            new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
 
-        minimumSpanningTree( input ).fromSource( a ).applyingPrimAlgorithm( null );
+        minimumSpanningTree( input ).fromSource( new BaseLabeledVertex( "A" ) ).applyingPrimAlgorithm(
null );
     }
     
     @Test( expected = IllegalStateException.class )

Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/ReverseDeleteTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/ReverseDeleteTestCase.java?rev=1290857&r1=1290856&r2=1290857&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/ReverseDeleteTestCase.java
(original)
+++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/spanning/ReverseDeleteTestCase.java
Sat Feb 18 20:22:36 2012
@@ -20,7 +20,6 @@ package org.apache.commons.graph.spannin
  */
 
 import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.fail;
 import static org.apache.commons.graph.CommonsGraph.minimumSpanningTree;
 
 import org.apache.commons.graph.SpanningTree;
@@ -50,22 +49,6 @@ public class ReverseDeleteTestCase
     public void testNullMonoid()
     {
         UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> input = null;
-        BaseLabeledVertex a = null;
-        try
-        {
-            input = new UndirectedMutableWeightedGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>();
-            a = new BaseLabeledVertex( "A" );
-            BaseLabeledVertex b = new BaseLabeledVertex( "B" );
-
-            input.addVertex( a );
-            input.addVertex( b );
-
-            input.addEdge( a, new BaseLabeledWeightedEdge<Double>( "a <-> b",
7D ), b );
-        }
-        catch ( NullPointerException e )
-        {
-            fail( e.getMessage() );
-        }
 
         minimumSpanningTree( input ).applyingReverseDeleteAlgorithm( null );
     }



Mime
View raw message