From: Yegor Kozlov Date: Sun, 22 Feb 2009 16:08:06 +0000 (+0000) Subject: fixed platform-dependent unit test X-Git-Tag: REL_3_5_BETA6~105 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fa2e0c0db310a614545c4ad5b59b54d19a2985e6;p=poi.git fixed platform-dependent unit test git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@746746 13f79535-47bb-0310-9956-ffa450edef68 --- 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 expectedValue = new TreeMap(); - 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)); } } }