diff options
author | Yegor Kozlov <yegor@apache.org> | 2009-02-22 16:08:06 +0000 |
---|---|---|
committer | Yegor Kozlov <yegor@apache.org> | 2009-02-22 16:08:06 +0000 |
commit | fa2e0c0db310a614545c4ad5b59b54d19a2985e6 (patch) | |
tree | d8578eaa85acf67dc22f25aeb9c0edb48d5dc1d8 | |
parent | ac5a227ccf53bcdfeffd0d058f2b90f2c73e1698 (diff) | |
download | poi-fa2e0c0db310a614545c4ad5b59b54d19a2985e6.tar.gz poi-fa2e0c0db310a614545c4ad5b59b54d19a2985e6.zip |
fixed platform-dependent unit test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@746746 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-x | src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestFileHelper.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestFileHelper.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestFileHelper.java index 280d6d9922..8829ca2922 100755 --- a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestFileHelper.java +++ b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestFileHelper.java @@ -33,13 +33,23 @@ public class TestFileHelper extends TestCase { public void testGetDirectory() {
TreeMap<String, String> expectedValue = new TreeMap<String, String>();
- expectedValue.put("c:\\test\\test.doc", "c:\\test");
- expectedValue.put("d:\\test\\test2\\test.doc.xml", "d:\\test\\test2");
+ expectedValue.put("/dir1/test.doc", "/dir1");
+ expectedValue.put("/dir1/dir2/test.doc.xml", "/dir1/dir2");
for (String filename : expectedValue.keySet()) {
- assertTrue(expectedValue.get(filename).equalsIgnoreCase(
- FileHelper.getDirectory(new File(filename))
- .getAbsolutePath()));
+ File f1 = new File(expectedValue.get(filename));
+ File f2 = FileHelper.getDirectory(new File(filename));
+
+ /*
+ * YK: The original version asserted expected values against File#getAbsolutePath():
+ * assertTrue(expectedValue.get(filename).equalsIgnoreCase(
+ * FileHelper.getDirectory(new File(filename))
+ * .getAbsolutePath()));
+ *
+ * This comparison is platform dependent and resulted in build errors in Gump since 21/02/2009.
+ * Assertion via File#equals(File otherFile) is a better approach.
+ */
+ assertTrue(f1.equals(f2));
}
}
}
|