You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2013/04/02 21:00:54 UTC

svn commit: r1463675 - /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCatalogResolver.java

Author: oheger
Date: Tue Apr  2 19:00:53 2013
New Revision: 1463675

URL: http://svn.apache.org/r1463675
Log:
Changed test class: Only use methods from FileBased interface to load and save XMLConfiguration objects.

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

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCatalogResolver.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCatalogResolver.java?rev=1463675&r1=1463674&r2=1463675&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCatalogResolver.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestCatalogResolver.java Tue Apr  2 19:00:53 2013
@@ -20,6 +20,7 @@ package org.apache.commons.configuration
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import org.apache.commons.configuration.io.FileHandler;
 import org.apache.commons.configuration.resolver.CatalogResolver;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -59,18 +60,28 @@ public class TestCatalogResolver
         config = null;
     }
 
+    /**
+     * Loads the test configuration from the specified file.
+     *
+     * @param fileName the file name
+     * @throws ConfigurationException if an error occurs
+     */
+    private void load(String fileName) throws ConfigurationException
+    {
+        FileHandler handler = new FileHandler(config);
+        handler.load(fileName);
+    }
+
     @Test
-    public void testPublic() throws Exception
+    public void testPublic() throws ConfigurationException
     {
-        config.setFileName(PUBLIC_FILE);
-        config.load();
+        load(PUBLIC_FILE);
     }
 
     @Test
-    public void testRewriteSystem() throws Exception
+    public void testRewriteSystem() throws ConfigurationException
     {
-        config.setFileName(REWRITE_SYSTEM_FILE);
-        config.load();
+        load(REWRITE_SYSTEM_FILE);
     }
 
     /**
@@ -79,11 +90,9 @@ public class TestCatalogResolver
      * @throws Exception
      */
     @Test
-    public void testSchemaResolver() throws Exception
+    public void testSchemaResolver() throws ConfigurationException
     {
-        config.setFileName(REWRITE_SCHEMA_FILE);
-        config.setSchemaValidation(true);
-        config.load();
+        load(REWRITE_SCHEMA_FILE);
     }
 
     @Test