Author: oheger
Date: Wed Jan 9 11:56:45 2008
New Revision: 610535
URL: http://svn.apache.org/viewvc?rev=610535&view=rev
Log:
Extended test helper class with functionality for accessing files
Modified:
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration/ConfigurationAssert.java
Modified:
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration/ConfigurationAssert.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration/ConfigurationAssert.java?rev=610535&r1=610534&r2=610535&view=diff
==============================================================================
---
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration/ConfigurationAssert.java
(original)
+++
commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration/ConfigurationAssert.java
Wed Jan 9 11:56:45 2008
@@ -17,18 +17,37 @@
package org.apache.commons.configuration;
+import java.io.File;
import java.util.Iterator;
import junit.framework.Assert;
/**
* Assertions on configurations for the unit tests.
- *
+ *
* @author Emmanuel Bourg
* @version $Revision$, $Date$
*/
public class ConfigurationAssert
{
+ /** Constant for the name of the directory with the test files. */
+ public static final String TEST_DIR_NAME = "src/test/resources";
+
+ /** Constant for the name of the directory with the output files. */
+ public static final String OUT_DIR_NAME = "target";
+
+ /** The directory with the test files. */
+ public static final File TEST_DIR = new File(TEST_DIR_NAME);
+
+ /** The directory with the output files. */
+ public static final File OUT_DIR = new File(OUT_DIR_NAME);
+
+ /**
+ * Checks the content of a configuration.
+ *
+ * @param expected the expected properties
+ * @param actual the configuration to check
+ */
public static void assertEquals(Configuration expected, Configuration
actual)
{
// check that the actual configuration contains all the properties of
the expected configuration
@@ -45,5 +64,25 @@
String key = (String) it.next();
Assert.assertTrue("The actual configuration contains an extra key
'" + key + "'", expected.containsKey(key));
}
+ }
+
+ /**
+ * Returns a <code>File</code> object for the specified test file.
+ * @param name the name of the test file
+ * @return a <code>File</code> object pointing to that test file
+ */
+ public static File getTestFile(String name)
+ {
+ return new File(TEST_DIR, name);
+ }
+
+ /**
+ * Returns a <code>File</code> object for the specified out file.
+ * @param name the name of the out file
+ * @return a <code>File</code> object pointing to that out file
+ */
+ public static File getOutFile(String name)
+ {
+ return new File(OUT_DIR, name);
}
}