3 import static org.testng.Assert.assertFalse;
4 import static org.testng.Assert.assertTrue;
6 import java.io.IOException;
7 import java.nio.file.Paths;
10 import org.testng.annotations.Test;
12 public class FileUtilsTest
14 @Test(groups = "Functional")
15 public void testFindMatchingPaths() throws IOException
17 String expect1 = Paths.get("..", "jalview", "examples", "plantfdx.fa")
19 String expect2 = Paths.get("../jalview/examples/plantfdx.features")
21 String expect3 = Paths
22 .get("../jalview/examples/testdata/plantfdx.features")
25 List<String> matches = FileUtils
26 .findMatchingPaths(Paths.get(".."),
27 ".*[\\\\/]plant.*\\.f.*");
28 System.out.println(matches);
29 assertTrue(matches.contains(expect1));
30 assertTrue(matches.contains(expect2));
31 assertTrue(matches.contains(expect3));
34 @Test(groups = "External")
35 public void testWindowsPath() throws IOException
37 if (System.getProperty("os.name").startsWith("Windows"))
40 * should pass provided Eclipse is installed
42 List<String> matches = FileUtils.findMatches("C:\\",
43 "Program Files*/eclips*/eclips?.exe");
44 assertFalse(matches.isEmpty());
47 * should pass provided Chimera is installed
49 matches = FileUtils.findMatches("C:\\",
50 "Program Files*/Chimera*/bin/{chimera,chimera.exe}");
51 assertFalse(matches.isEmpty());
55 @Test(groups = "Functional")
56 public void testFindMatches() throws IOException
58 String expect1 = Paths.get("..", "jalview", "examples", "plantfdx.fa")
60 String expect2 = Paths.get("../jalview/examples/plantfdx.features")
62 String expect3 = Paths
63 .get("../jalview/examples/testdata/plantfdx.features")
66 List<String> matches = FileUtils
67 .findMatches("..", "jalview/ex*/plant*.f*");
68 System.out.println(matches);
69 assertTrue(matches.contains(expect1));
70 assertTrue(matches.contains(expect2));
71 assertFalse(matches.contains(expect3));