X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Futil%2FFileUtilsTest.java;h=07fd375151d3aa6c93f928228fee2f9f5b933779;hb=1deb45d06fc8fa719bd19b25959397d8b3fd9274;hp=aed914202617cf0520233c67c5cc891f95b46c20;hpb=b7daf709cea5ab435e001d8dad72d134ba0a5b47;p=jalview.git diff --git a/test/jalview/util/FileUtilsTest.java b/test/jalview/util/FileUtilsTest.java index aed9142..07fd375 100644 --- a/test/jalview/util/FileUtilsTest.java +++ b/test/jalview/util/FileUtilsTest.java @@ -1,5 +1,6 @@ package jalview.util; +import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import java.io.IOException; @@ -13,7 +14,7 @@ public class FileUtilsTest @Test(groups = "Functional") public void testFindMatchingPaths() throws IOException { - String expect1 = Paths.get("../jalview/examples/plantfdx.fa") + String expect1 = Paths.get("..", "jalview", "examples", "plantfdx.fa") .toString(); String expect2 = Paths.get("../jalview/examples/plantfdx.features") .toString(); @@ -21,10 +22,52 @@ public class FileUtilsTest .get("../jalview/examples/testdata/plantfdx.features") .toString(); - List matches = FileUtils.findMatchingPaths(".*/plant.*\\.f.*", - Paths.get("..")); + List matches = FileUtils + .findMatchingPaths(Paths.get(".."), + ".*[/\\\\]plant.*\\.f.*"); + System.out.println(matches); assertTrue(matches.contains(expect1)); assertTrue(matches.contains(expect2)); assertTrue(matches.contains(expect3)); } + + @Test(groups = "External") + public void testWindowsPath() throws IOException + { + if (System.getProperty("os.name").startsWith("Windows")) + { + /* + * should pass provided Eclipse is installed + */ + List matches = FileUtils.findMatches("C:\\", + "Program Files*/eclips*/eclips?.exe"); + assertFalse(matches.isEmpty()); + + /* + * should pass provided Chimera is installed + */ + matches = FileUtils.findMatches("C:\\", + "Program Files*/Chimera*/bin/{chimera,chimera.exe}"); + assertFalse(matches.isEmpty()); + } + } + + @Test(groups = "Functional") + public void testFindMatches() throws IOException + { + String expect1 = Paths.get("..", "jalview", "examples", "plantfdx.fa") + .toString(); + String expect2 = Paths.get("../jalview/examples/plantfdx.features") + .toString(); + String expect3 = Paths + .get("../jalview/examples/testdata/plantfdx.features") + .toString(); + + List matches = FileUtils + .findMatches("..", "jalview/ex*/plant*.f*"); + System.out.println(matches); + assertTrue(matches.contains(expect1)); + assertTrue(matches.contains(expect2)); + assertFalse(matches.contains(expect3)); + } }