commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r833018 - /commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/base/TestInMemoryConfigurationSource.java
Date Thu, 05 Nov 2009 07:39:25 GMT
Author: oheger
Date: Thu Nov  5 07:39:24 2009
New Revision: 833018

URL: http://svn.apache.org/viewvc?rev=833018&view=rev
Log:
Switched test for InMemoryConfigurationSource to JUnit 4 style.

Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/base/TestInMemoryConfigurationSource.java

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/base/TestInMemoryConfigurationSource.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/base/TestInMemoryConfigurationSource.java?rev=833018&r1=833017&r2=833018&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/base/TestInMemoryConfigurationSource.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/base/TestInMemoryConfigurationSource.java
Thu Nov  5 07:39:24 2009
@@ -16,11 +16,16 @@
  */
 package org.apache.commons.configuration2.base;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.commons.configuration2.expr.ConfigurationNodeHandler;
 import org.apache.commons.configuration2.tree.ConfigurationNode;
 import org.apache.commons.configuration2.tree.DefaultConfigurationNode;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Test class for {@link InMemoryConfigurationSource}.
@@ -28,7 +33,7 @@
  * @author Commons Configuration team
  * @version $Id$
  */
-public class TestInMemoryConfigurationSource extends TestCase
+public class TestInMemoryConfigurationSource
 {
     /** The source to be tested. */
     private InMemoryConfigurationSource source;
@@ -37,10 +42,9 @@
      * Initializes the configuration source with the following structure: tables
      * table name fields field name field name
      */
-    @Override
-    protected void setUp() throws Exception
+    @Before
+    public void setUp() throws Exception
     {
-        super.setUp();
         source = new InMemoryConfigurationSource();
     }
 
@@ -60,6 +64,7 @@
     /**
      * Tests a newly created instance.
      */
+    @Test
     public void testInit()
     {
         checkEmptyRoot();
@@ -68,6 +73,7 @@
     /**
      * Tests setting a new root node.
      */
+    @Test
     public void testSetRootNode()
     {
         DefaultConfigurationNode node = new DefaultConfigurationNode();
@@ -78,22 +84,16 @@
     /**
      * Tests setting the root node to null. This should cause an exception.
      */
+    @Test(expected = IllegalArgumentException.class)
     public void testSetRootNodeNull()
     {
-        try
-        {
-            source.setRootNode(null);
-            fail("Could set null root node!");
-        }
-        catch (IllegalArgumentException iex)
-        {
-            // ok
-        }
+        source.setRootNode(null);
     }
 
     /**
      * Tests the clear() implementation.
      */
+    @Test
     public void testClear()
     {
         source.getRootNode().setValue("Test");
@@ -108,6 +108,7 @@
     /**
      * Tests the node handler used by the model.
      */
+    @Test
     public void testGetNodeHandler()
     {
         assertTrue("Wrong node handler",



Mime
View raw message