JAL-4153 comments re patch incorrectly committed under JAL-4513
[jalview.git] / test / jalview / util / FileUtilsTest.java
index d49fd4c..35853b0 100644 (file)
@@ -21,6 +21,7 @@
 package jalview.util;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.List;
 
 import org.testng.Assert;
@@ -67,7 +68,7 @@ public class FileUtilsTest
     else if (where < 0)
       Assert.assertTrue(d.startsWith(dirname),
               "getDirname(" + file.getPath() + ")=" + d
-                      + " didn't start with '" + d + "'");
+                      + " didn't start with '" + dirname + "'");
     else if (where > 0)
       Assert.assertTrue(d.endsWith(dirname), "getDirname(" + file.getPath()
               + ")=" + d + " didn't end with '" + d + "'");
@@ -100,13 +101,22 @@ public class FileUtilsTest
   @DataProvider(name = "dirnamesAndBasenames")
   public Object[][] dirnamesAndBasenames()
   {
+    String homeDir = null;
+    try
+    {
+      homeDir = new File(System.getProperty("user.home"))
+              .getCanonicalPath();
+    } catch (IOException e)
+    {
+      System.err.println("Problem getting canonical home dir");
+      e.printStackTrace();
+    }
     return new Object[][] { // -1=startsWith, 0=equals, 1=endsWith
-        { "~/hello/sailor", -1, System.getProperty("user.home"), "sailor",
-            "~" }, //
+        { "~/hello/sailor", -1, homeDir, "sailor", "~" }, //
         { "~/hello/sailor", 1, "/hello", "sailor", "~" }, //
-        { "./examples/uniref50.fa", -1, "/", "uniref50", null }, //
-        { "./examples/uniref50.fa", 1, "/examples", "uniref50", null }, //
-        { "examples/uniref50.fa", 1, "/examples", "uniref50", null }, //
+        { "./examples/uniref50.fa", -1, "/", "uniref50", "." }, //
+        { "./examples/uniref50.fa", 1, "/examples", "uniref50", "." }, //
+        { "examples/uniref50.fa", 1, "/examples", "uniref50", ".fa" }, //
     };
   }
 }