1package test.ant;
2
3import static org.testng.AssertJUnit.assertEquals;
4
5import org.testng.annotations.Test;
6
7import java.io.File;
8
9
10/**
11 * Tests some of the functionality in {@link TestNGCommandLineArgs}.
12 *
13 * @author jkuhnert
14 */
15public class TestCommandLineArgs
16{
17
18  @Test
19  public void testUnixPathResolution()
20  {
21    String path = "/wee/wom/flibble.txt";
22
23    String[] segments = path.split("[/\\\\]", -1);
24
25    assertEquals(4, segments.length);
26    assertEquals("wee", segments[1]);
27  }
28
29  @Test
30  public void testDOSPathResolution()
31  {
32    String path = "c:\\\\com\\pants\\wibble.txt";
33
34    String[] segments = path.split("[/\\\\]", -1);
35
36    assertEquals(5, segments.length);
37    assertEquals("com", segments[2]); // because c: is actually \\ which will be split twice
38  }
39
40  @Test
41  public void testPathResolution()
42  {
43    File file = new File("pom.xml");
44
45    assert file.exists();
46
47    String path = file.getAbsolutePath();
48
49    assert path.split("[/\\\\]", -1).length > 1;
50  }
51}
52