Author: oheger
Date: Thu Dec 22 20:53:47 2011
New Revision: 1222445

URL: http://svn.apache.org/viewvc?rev=1222445&view=rev
Log:
Converted tests to junit 4, fixed warnings.

Modified:
    
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/BaseNonStringProperties.java
    
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/NonStringTestHolder.java
    
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCompositeConfigurationNonStringProperties.java
    
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestNonStringProperties.java

Modified: 
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/BaseNonStringProperties.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/BaseNonStringProperties.java?rev=1222445&r1=1222444&r2=1222445&view=diff
==============================================================================
--- 
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/BaseNonStringProperties.java
 (original)
+++ 
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/BaseNonStringProperties.java
 Thu Dec 22 20:53:47 2011
@@ -1,5 +1,3 @@
-package org.apache.commons.configuration;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -16,32 +14,37 @@ package org.apache.commons.configuration
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.commons.configuration;
+
+import static org.junit.Assert.assertEquals;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 /**
  * Test if non-string properties are handled correctly.
  *
  * @version $Id$
  */
-public abstract class BaseNonStringProperties extends TestCase
+public abstract class BaseNonStringProperties
 {
 
     protected NonStringTestHolder nonStringTestHolder = new 
NonStringTestHolder();
-    public abstract void setUp() throws Exception;
 
-    public Configuration conf = null;
+    protected Configuration conf;
 
+    @Test
     public void testBoolean() throws Exception
     {
         nonStringTestHolder.testBoolean();
     }
 
+    @Test
     public void testBooleanDefaultValue() throws Exception
     {
         nonStringTestHolder.testBooleanDefaultValue();
     }
 
+    @Test
     public void testBooleanArrayValue() throws Exception
     {
         boolean booleanValue = conf.getBoolean("test.boolean");
@@ -49,11 +52,13 @@ public abstract class BaseNonStringPrope
         assertEquals(2, conf.getList("test.boolean.array").size());
     }
 
+    @Test
     public void testByte() throws Exception
     {
         nonStringTestHolder.testByte();
     }
 
+    @Test
     public void testByteArrayValue() throws Exception
     {
         byte testValue = 10;
@@ -62,16 +67,19 @@ public abstract class BaseNonStringPrope
         assertEquals(2, conf.getList("test.byte.array").size());
     }
 
+    @Test
     public void testDouble() throws Exception
     {
         nonStringTestHolder.testDouble();
     }
 
+    @Test
     public void testDoubleDefaultValue() throws Exception
     {
         nonStringTestHolder.testDoubleDefaultValue();
     }
 
+    @Test
     public void testDoubleArrayValue() throws Exception
     {
         double testValue = 10.25;
@@ -80,17 +88,20 @@ public abstract class BaseNonStringPrope
         assertEquals(2, conf.getList("test.double.array").size());
     }
 
+    @Test
     public void testFloat() throws Exception
     {
         nonStringTestHolder.testFloat();
     }
 
+    @Test
     public void testFloatDefaultValue() throws Exception
     {
         nonStringTestHolder.testFloatDefaultValue();
 
     }
 
+    @Test
     public void testFloatArrayValue() throws Exception
     {
         float testValue = (float) 20.25;
@@ -99,16 +110,19 @@ public abstract class BaseNonStringPrope
         assertEquals(2, conf.getList("test.float.array").size());
     }
 
+    @Test
     public void testInteger() throws Exception
     {
         nonStringTestHolder.testInteger();
     }
 
+    @Test
     public void testIntegerDefaultValue() throws Exception
     {
         nonStringTestHolder.testIntegerDefaultValue();
     }
 
+    @Test
     public void testIntegerArrayValue() throws Exception
     {
         int intValue = conf.getInt("test.integer");
@@ -116,14 +130,19 @@ public abstract class BaseNonStringPrope
         assertEquals(2, conf.getList("test.integer.array").size());
     }
 
+    @Test
     public void testLong() throws Exception
     {
         nonStringTestHolder.testLong();
     }
+
+    @Test
     public void testLongDefaultValue() throws Exception
     {
         nonStringTestHolder.testLongDefaultValue();
     }
+
+    @Test
     public void testLongArrayValue() throws Exception
     {
         long longValue = conf.getLong("test.long");
@@ -131,15 +150,19 @@ public abstract class BaseNonStringPrope
         assertEquals(2, conf.getList("test.long.array").size());
     }
 
+    @Test
     public void testShort() throws Exception
     {
         nonStringTestHolder.testShort();
     }
 
+    @Test
     public void testShortDefaultValue() throws Exception
     {
         nonStringTestHolder.testShortDefaultValue();
     }
+
+    @Test
     public void testShortArrayValue() throws Exception
     {
         short shortValue = conf.getShort("test.short");
@@ -147,15 +170,19 @@ public abstract class BaseNonStringPrope
         assertEquals(2, conf.getList("test.short.array").size());
     }
 
+    @Test
     public void testListMissing() throws Exception
     {
         nonStringTestHolder.testListMissing();
     }
 
+    @Test
     public void testSubset() throws Exception
     {
         nonStringTestHolder.testSubset();
     }
+
+    @Test
     public void testIsEmpty() throws Exception
     {
         nonStringTestHolder.testIsEmpty();

Modified: 
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/NonStringTestHolder.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/NonStringTestHolder.java?rev=1222445&r1=1222444&r2=1222445&view=diff
==============================================================================
--- 
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/NonStringTestHolder.java
 (original)
+++ 
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/NonStringTestHolder.java
 Thu Dec 22 20:53:47 2011
@@ -23,9 +23,9 @@ import java.util.List;
 import junit.framework.Assert;
 
 /**
- * Pulling out the calls to do the tests so both JUnit and Cactus tests 
+ * Pulling out the calls to do the tests so both JUnit and Cactus tests
  * can share.
- * 
+ *
  * @version $Id$
  */
 public class NonStringTestHolder
@@ -41,7 +41,7 @@ public class NonStringTestHolder
     {
         boolean booleanValue = configuration.getBoolean("test.boolean");
         Assert.assertEquals(true, booleanValue);
-        Assert.assertEquals(1, configuration.getList("test.boolean").size());  
      
+        Assert.assertEquals(1, configuration.getList("test.boolean").size());
     }
 
     public void testBooleanDefaultValue() throws Exception
@@ -82,7 +82,7 @@ public class NonStringTestHolder
         float testValue = (float) 20.25;
         float floatValue = configuration.getFloat("test.float");
         Assert.assertEquals(testValue, floatValue, 0.01);
-        Assert.assertEquals(1, configuration.getList("test.float").size());    
   
+        Assert.assertEquals(1, configuration.getList("test.float").size());
     }
 
     public void testFloatDefaultValue() throws Exception
@@ -132,7 +132,7 @@ public class NonStringTestHolder
 
     public void testListMissing() throws Exception
     {
-        List list = configuration.getList("missing.list");
+        List<?> list = configuration.getList("missing.list");
         Assert.assertTrue("'missing.list' is not empty", list.isEmpty());
     }
 
@@ -142,10 +142,10 @@ public class NonStringTestHolder
 
         // search the "short" key in the subset using the key iterator
         boolean foundKeyValue = false;
-        Iterator it = subset.getKeys();
+        Iterator<String> it = subset.getKeys();
         while (it.hasNext() && !foundKeyValue)
         {
-            String key = (String) it.next();
+            String key = it.next();
             foundKeyValue = "short".equals(key);
         }
 

Modified: 
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCompositeConfigurationNonStringProperties.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCompositeConfigurationNonStringProperties.java?rev=1222445&r1=1222444&r2=1222445&view=diff
==============================================================================
--- 
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCompositeConfigurationNonStringProperties.java
 (original)
+++ 
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCompositeConfigurationNonStringProperties.java
 Thu Dec 22 20:53:47 2011
@@ -17,6 +17,8 @@
 
 package org.apache.commons.configuration;
 
+import org.junit.Before;
+
 
 /**
  * Test if non-string properties are handled correctly.
@@ -28,6 +30,7 @@ public class TestCompositeConfigurationN
     /** The File that we test with */
     private String testProperties = 
ConfigurationAssert.getTestFile("test.properties").getAbsolutePath();
 
+    @Before
     public void setUp() throws Exception
     {
         CompositeConfiguration cc = new CompositeConfiguration();
@@ -35,5 +38,4 @@ public class TestCompositeConfigurationN
         conf = cc;
         nonStringTestHolder.setConfiguration(conf);
     }
-
 }

Modified: 
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestNonStringProperties.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestNonStringProperties.java?rev=1222445&r1=1222444&r2=1222445&view=diff
==============================================================================
--- 
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestNonStringProperties.java
 (original)
+++ 
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestNonStringProperties.java
 Thu Dec 22 20:53:47 2011
@@ -17,6 +17,7 @@
 
 package org.apache.commons.configuration;
 
+import org.junit.Before;
 
 /**
  * Test if non-string properties are handled correctly.
@@ -28,10 +29,10 @@ public class TestNonStringProperties ext
     /** The File that we test with */
     private String testProperties = 
ConfigurationAssert.getTestFile("test.properties").getAbsolutePath();
 
+    @Before
     public void setUp() throws Exception
     {
         conf = new PropertiesConfiguration(testProperties);
         nonStringTestHolder.setConfiguration(conf);
     }
-
 }


Reply via email to