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
15 * FIXME fails on bamboo since it the working directory named according to the build number
17 @Test(groups = {"Functional","Not-bamboo"})
18 public void testFindMatchingPaths() throws IOException
20 String expect1 = Paths.get("..", "jalview", "examples", "plantfdx.fa")
22 String expect2 = Paths.get("../jalview/examples/plantfdx.features")
24 String expect3 = Paths
25 .get("../jalview/examples/testdata/plantfdx.features")
28 List<String> matches = FileUtils
29 .findMatchingPaths(Paths.get(".."),
30 ".*[\\\\/]plant.*\\.f.*");
31 System.out.println(matches);
32 assertTrue(matches.contains(expect1));
33 assertTrue(matches.contains(expect2));
34 assertTrue(matches.contains(expect3));
37 @Test(groups = "External")
38 public void testWindowsPath() throws IOException
40 if (System.getProperty("os.name").startsWith("Windows"))
43 * should pass provided Eclipse is installed
45 List<String> matches = FileUtils.findMatches("C:\\",
46 "Program Files*/eclips*/eclips?.exe");
47 assertFalse(matches.isEmpty());
50 * should pass provided Chimera is installed
52 matches = FileUtils.findMatches("C:\\",
53 "Program Files*/Chimera*/bin/{chimera,chimera.exe}");
54 assertFalse(matches.isEmpty());
59 * FIXME fails on bamboo since it the working directory named according to the build number
61 @Test(groups = {"Functional","Not-bamboo"})
62 public void testFindMatches() throws IOException
64 String expect1 = Paths.get("..", "jalview", "examples", "plantfdx.fa")
66 String expect2 = Paths.get("../jalview/examples/plantfdx.features")
68 String expect3 = Paths
69 .get("../jalview/examples/testdata/plantfdx.features")
72 List<String> matches = FileUtils
73 .findMatches("..", "jalview/ex*/plant*.f*");
74 System.out.println(matches);
75 assertTrue(matches.contains(expect1));
76 assertTrue(matches.contains(expect2));
77 assertFalse(matches.contains(expect3));