Merge branch 'feature/JAL-3551Pymol' into feature/JAL-2422ChimeraX
[jalview.git] / test / jalview / ext / pymol / PymolManagerTest.java
index 19b779d..c415ace 100644 (file)
@@ -1,11 +1,14 @@
 package jalview.ext.pymol;
 
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
 
-import jalview.structure.StructureCommand;
+import java.util.List;
 
 import org.testng.annotations.Test;
 
+import jalview.structure.StructureCommand;
+
 public class PymolManagerTest
 {
   @Test(groups = "Functional")
@@ -23,4 +26,39 @@ public class PymolManagerTest
             + "<parameter><value>all</value></parameter>"
             + "</params></methodCall>");
   }
+
+  @Test(groups = "Functional")
+  public void testGetPymolPaths()
+  {
+    /*
+     * OSX
+     */
+    List<String> paths = PymolManager.getPymolPaths("Mac OS X");
+    assertEquals(paths.size(), 1);
+    assertTrue(
+            paths.contains("/Applications/PyMOL.app/Contents/MacOS/PyMOL"));
+
+    /*
+     * Linux
+     */
+    paths = PymolManager.getPymolPaths("Linux i386 1.5.0");
+    assertTrue(paths.contains("/usr/local/pymol/bin/PyMOL"));
+    assertTrue(paths.contains("/usr/local/bin/PyMOL"));
+    assertTrue(paths.contains("/usr/bin/PyMOL"));
+    assertTrue(paths.contains("/usr/local/pymol/bin/PyMOL"));
+    assertTrue(paths
+            .contains(System.getProperty("user.home") + "/opt/bin/PyMOL"));
+
+    /*
+     * Windows
+     */
+    paths = PymolManager.getPymolPaths("Windows 10");
+    assertTrue(paths.isEmpty()); // TODO - Windows paths
+
+    /*
+     * Other
+     */
+    paths = PymolManager.getPymolPaths("VAX/VMS");
+    assertTrue(paths.isEmpty());
+  }
 }