commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1223010 - /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationConverter.java
Date Sat, 24 Dec 2011 20:21:36 GMT
Author: oheger
Date: Sat Dec 24 20:21:36 2011
New Revision: 1223010

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

Modified:
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationConverter.java

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationConverter.java?rev=1223010&r1=1223009&r2=1223010&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationConverter.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationConverter.java
Sat Dec 24 20:21:36 2011
@@ -17,13 +17,15 @@
 
 package org.apache.commons.configuration;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
-import junit.framework.TestCase;
-
 import org.apache.commons.collections.ExtendedProperties;
+import org.junit.Test;
 
 /**
  * Tests the ConfigurationConverter class.
@@ -32,8 +34,9 @@ import org.apache.commons.collections.Ex
  * @author Emmanuel Bourg
  * @version $Id$
  */
-public class TestConfigurationConverter extends TestCase
+public class TestConfigurationConverter
 {
+    @Test
     public void testExtendedPropertiesToConfiguration()
     {
         ExtendedProperties eprops = new ExtendedProperties();
@@ -45,12 +48,13 @@ public class TestConfigurationConverter 
         Configuration config = ConfigurationConverter.getConfiguration(eprops);
 
         assertEquals("This returns 'teststring'", "teststring", config.getString("string"));
-        List item1 = config.getList("list");
-        assertEquals("This returns 'item 1'", "item 1", (String) item1.get(0));
+        List<Object> item1 = config.getList("list");
+        assertEquals("This returns 'item 1'", "item 1", item1.get(0));
 
         assertEquals("This returns 123", 123, config.getInt("int"));
     }
 
+    @Test
     public void testPropertiesToConfiguration()
     {
         Properties props = new Properties();
@@ -61,12 +65,13 @@ public class TestConfigurationConverter 
         Configuration config = ConfigurationConverter.getConfiguration(props);
 
         assertEquals("This returns 'teststring'", "teststring", config.getString("string"));
-        List item1 = config.getList("list");
-        assertEquals("This returns 'item 1'", "item 1", (String) item1.get(0));
+        List<Object> item1 = config.getList("list");
+        assertEquals("This returns 'item 1'", "item 1", item1.get(0));
 
         assertEquals("This returns 123", 123, config.getInt("int"));
     }
 
+    @Test
     public void testConfigurationToExtendedProperties()
     {
         Configuration config = new BaseConfiguration();
@@ -78,11 +83,12 @@ public class TestConfigurationConverter 
         ExtendedProperties eprops = ConfigurationConverter.getExtendedProperties(config);
 
         assertEquals("This returns 'teststring'", "teststring", eprops.getString("string"));
-        List list = eprops.getVector("list");
-        assertEquals("This returns 'item 1'", "item 1", (String) list.get(0));
+        List<?> list = eprops.getVector("list");
+        assertEquals("This returns 'item 1'", "item 1", list.get(0));
         assertEquals("This returns 123", 123, eprops.getInt("int"));
     }
 
+    @Test
     public void testConfigurationToProperties()
     {
         BaseConfiguration config = new BaseConfiguration();
@@ -111,6 +117,7 @@ public class TestConfigurationConverter 
      * Tests the conversion of a configuration object to properties if scalar
      * values are involved. This test is related to CONFIGURATION-432.
      */
+    @Test
     public void testConfigurationToPropertiesScalarValue()
     {
         BaseConfiguration config = new BaseConfiguration();
@@ -119,12 +126,13 @@ public class TestConfigurationConverter 
         assertEquals("Wrong value", "42", props.getProperty("scalar"));
     }
 
+    @Test
     public void testConfigurationToMap()
     {
         Configuration config = new BaseConfiguration();
         config.addProperty("string", "teststring");
 
-        Map map = ConfigurationConverter.getMap(config);
+        Map<Object, Object> map = ConfigurationConverter.getMap(config);
 
         assertNotNull("null map", map);
         assertEquals("'string' property", "teststring", map.get("string"));



Mime
View raw message