From 82927e58aa86abee1ab11da889cabbebb18e90ad Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 12 Apr 2023 14:41:23 +0100 Subject: [PATCH] JAL-629 Fixed ~ based test for build server --- test/jalview/util/FileUtilsTest.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/jalview/util/FileUtilsTest.java b/test/jalview/util/FileUtilsTest.java index d49fd4c..79c703f 100644 --- a/test/jalview/util/FileUtilsTest.java +++ b/test/jalview/util/FileUtilsTest.java @@ -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,9 +101,18 @@ 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 }, // -- 1.7.10.2