-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathFileSystemPathTest.java
56 lines (41 loc) · 1.28 KB
/
FileSystemPathTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package by.andd3dfx.common;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class FileSystemPathTest {
@Test
public void moveToParentDir() {
FileSystemPath path = new FileSystemPath("/a/b/c/d");
path.cd("../x");
assertThat(path.getPath()).isEqualTo("/a/b/c/x");
}
@Test
public void moveToParentDir2() {
FileSystemPath path = new FileSystemPath("/a/b/c/d");
path.cd("../../x/d");
assertThat(path.getPath()).isEqualTo("/a/b/x/d");
}
@Test
public void moveToPathFromRoot() {
FileSystemPath path = new FileSystemPath("/a/b/c/d");
path.cd("/f/g/h");
assertThat(path.getPath()).isEqualTo("/f/g/h");
}
@Test
public void moveToRootDirectly() {
FileSystemPath path = new FileSystemPath("/a/b/c/d");
path.cd("/");
assertThat(path.getPath()).isEqualTo("/");
}
@Test
public void moveFromCurrentDir() {
FileSystemPath path = new FileSystemPath("/a/b/c/d");
path.cd("./f/g");
assertThat(path.getPath()).isEqualTo("/a/b/c/d/f/g");
}
@Test
public void moveFromCurrentDir2() {
FileSystemPath path = new FileSystemPath("/a/b/c/d");
path.cd("f/g");
assertThat(path.getPath()).isEqualTo("/a/b/c/d/f/g");
}
}