JAL-3130 JAL-1889 reportCurrentWorkingDirectory test to report absolute path when...
[jalview.git] / test / jalview / bin / CommandLineOperations.java
index 98e4eb5..cb08563 100644 (file)
  */
 package jalview.bin;
 
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
 import jalview.gui.JvOptionPane;
 
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 
 import org.testng.Assert;
@@ -191,6 +196,21 @@ public class CommandLineOperations
     return worker;
   }
 
+  @Test(groups = { "Functional" })
+  public void reportCurrentWorkingDirectory()
+  {
+    try
+    {
+      Path currentRelativePath = Paths.get("");
+      String s = currentRelativePath.toAbsolutePath().toString();
+      System.out.println("Test CWD is " + s);
+      System.err.println("Test CWD is " + s);
+    } catch (Exception q)
+    {
+      q.printStackTrace();
+    }
+  }
+
   @BeforeTest(alwaysRun = true)
   public void initialize()
   {
@@ -262,8 +282,7 @@ public class CommandLineOperations
     file.deleteOnExit();
     Worker worker = getJalviewDesktopRunner(withAWT, cmd, timeout);
     assertNotNull(worker, "worker is null");
-    String msg = "Didn't create an output" + type + " file at '"
-            + file.getAbsolutePath() + "'.[" + harg + "]";
+    String msg = "Didn't create an output" + type + " file.[" + harg + "]";
     assertTrue(file.exists(), msg);
     FileAssert.assertFile(file, msg);
     FileAssert.assertMinLength(file, expectedMinFileSize);