Repository navigation
Expand file tree
/
Copy pathMkdirTest.java
More file actions
51 lines (42 loc) · 1.38 KB
/
Copy pathMkdirTest.java
File metadata and controls
51 lines (42 loc) · 1.38 KB
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
package commands;
import driver.JShellState;
import file_system.Directory;
import file_system.VirtualFileSystem;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.List;
import static org.junit.Assert.*;
public class MkdirTest {
JShellState shellState;
CommandController commandExecutor;
@Before
public void setUp() throws Exception {
VirtualFileSystem.resetFileSystemInstance();
shellState = new JShellState();
commandExecutor = new CommandController();
}
@After
public void tearDown() throws Exception {
}
@Test
public void testExecuteCommandHistory() {
try {
String output = commandExecutor.executeCommand(shellState, "mkdir test");
List<String> history = shellState.getHistory();
assertEquals("mkdir test", history.get(0));
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testExecuteCommandNewDir() {
try {
String output = commandExecutor.executeCommand(shellState, "mkdir test");
VirtualFileSystem fileSystem = shellState.getFileSystem();
Directory newDir = fileSystem.getDirectoryByPath(fileSystem.getRoot(), "test");
} catch (Exception e) {
fail("Could not retrieve new directory using getDirectoryByPath");
}
}
}