]> source.dussan.org Git - poi.git/commitdiff
fixed platform-dependent unit test
authorYegor Kozlov <yegor@apache.org>
Sun, 22 Feb 2009 16:08:06 +0000 (16:08 +0000)
committerYegor Kozlov <yegor@apache.org>
Sun, 22 Feb 2009 16:08:06 +0000 (16:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@746746 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/openxml4j/opc/TestFileHelper.java

index 280d6d9922cbbcd9472d1fea6ce5e8fcf380de49..8829ca292225968fe5ad37c9a7611e8b029e2234 100755 (executable)
@@ -33,13 +33,23 @@ public class TestFileHelper extends TestCase {
 \r
        public void testGetDirectory() {\r
                TreeMap<String, String> expectedValue = new TreeMap<String, String>();\r
-               expectedValue.put("c:\\test\\test.doc", "c:\\test");\r
-               expectedValue.put("d:\\test\\test2\\test.doc.xml", "d:\\test\\test2");\r
+               expectedValue.put("/dir1/test.doc", "/dir1");\r
+               expectedValue.put("/dir1/dir2/test.doc.xml", "/dir1/dir2");\r
 \r
                for (String filename : expectedValue.keySet()) {\r
-                       assertTrue(expectedValue.get(filename).equalsIgnoreCase(\r
-                                       FileHelper.getDirectory(new File(filename))\r
-                                                       .getAbsolutePath()));\r
+            File f1 = new File(expectedValue.get(filename));\r
+            File f2 = FileHelper.getDirectory(new File(filename));\r
+\r
+            /*\r
+             * YK: The original version asserted expected values against File#getAbsolutePath():\r
+             * assertTrue(expectedValue.get(filename).equalsIgnoreCase(\r
+             *        FileHelper.getDirectory(new File(filename))\r
+             *                .getAbsolutePath()));\r
+             *\r
+             * This comparison is platform dependent and resulted in build errors in Gump since 21/02/2009.\r
+             * Assertion via File#equals(File otherFile) is a better approach. \r
+             */\r
+            assertTrue(f1.equals(f2));\r
                }\r
        }\r
 }\r