package jalview.util;
+import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
@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();
.get("../jalview/examples/testdata/plantfdx.features")
.toString();
- List<String> matches = FileUtils.findMatchingPaths(".*/plant.*\\.f.*",
- Paths.get(".."));
+ List<String> 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<String> 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<String> matches = FileUtils
+ .findMatches("..", "jalview/ex*/plant*.f*");
+ System.out.println(matches);
+ assertTrue(matches.contains(expect1));
+ assertTrue(matches.contains(expect2));
+ assertFalse(matches.contains(expect3));
+ }
}