You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/05/21 18:58:41 UTC

svn commit: r1125744 - /commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/TestFactoryCreate.java

Author: simonetripodi
Date: Sat May 21 16:58:41 2011
New Revision: 1125744

URL: http://svn.apache.org/viewvc?rev=1125744&view=rev
Log:
parametrized tests moved to proper JUnit4 parametrization

Modified:
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/TestFactoryCreate.java

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/TestFactoryCreate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/TestFactoryCreate.java?rev=1125744&r1=1125743&r2=1125744&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/TestFactoryCreate.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/TestFactoryCreate.java Sat May 21 16:58:41 2011
@@ -23,11 +23,15 @@ import static org.junit.Assert.fail;
 
 import java.io.StringReader;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import org.apache.commons.digester3.AbstractObjectCreationFactory;
 import org.apache.commons.digester3.Digester;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
 import org.xml.sax.Attributes;
 
 /**
@@ -35,10 +39,28 @@ import org.xml.sax.Attributes;
  * 
  * @author Robert Burrell Donkin
  */
-
+@RunWith(value = Parameterized.class)
 public class TestFactoryCreate
 {
 
+    private final boolean propagateExceptions;
+
+    public TestFactoryCreate( boolean propagateExceptions )
+    {
+        this.propagateExceptions = propagateExceptions;
+    }
+
+    @Parameters
+    public static Collection<Object[]> data()
+    {
+        Collection<Object[]> data = new ArrayList<Object[]>(2);
+
+        data.add( new Object[] { true } );
+        data.add( new Object[] { false } );
+
+        return data;
+    }
+
     // --------------------------------------------------------------- Test cases
 
     @Test
@@ -111,13 +133,6 @@ public class TestFactoryCreate
     public void testFactoryCreateRule()
         throws Exception
     {
-        tryVariations( true );
-        tryVariations( false );
-    }
-
-    private void tryVariations( boolean propagateExceptions )
-        throws Exception
-    {
 
         // test passing object create
         Digester digester = new Digester();