@Test
 public void testCd() {
   String commandline = "cd .. | echo";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f2, null);
   String expectedOutput = "";
   assertEquals(expectedOutput, output);
 }
 @Test
 public void testCd2() {
   String commandline = "cd " + f2 + "| echo this is test";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f1, null);
   String expectedOutput = "this is test";
   assertEquals(expectedOutput, output);
 }
 @Test
 public void testEcho2() {
   String commandline = "echo | echo repeat";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f1, null);
   String expectedOutput = "repeat";
   assertEquals(expectedOutput, output);
 }
 @Test
 public void testPwd2() {
   String commandline = "pwd rubbishvalue | echo " + f1.getAbsolutePath();
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f1, null);
   String expectedOutput = f1.getAbsolutePath();
   assertEquals(expectedOutput, output);
 }
 @Test
 public void testCopy() {
   String commandline = "copy  | echo 1234";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f1, null);
   String expectedOutput = "1234";
   assertEquals(expectedOutput, output);
 }
 @Test
 public void testCd2() {
   String commandline = "cd " + f2 + "| move " + file1 + " " + file2;
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   pipingTool.execute(f1, null);
   assertFalse(file1.exists());
   assertTrue(file2.exists());
 }
 @Test
 public void testMove() {
   String commandline = "move " + file1 + " " + f1 + "| echo this is test";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f1, null);
   String expectedOutput = "this is test";
   assertEquals(expectedOutput, output);
   file1.mkdir();
 }
 @Test
 public void testDelete2() {
   String commandline = "delete testFolder2 | echo";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f1, null);
   String expectedOutput = "";
   assertEquals(expectedOutput, output);
   f2.mkdirs();
 }
 @Test
 public void testDelete() {
   String commandline = "delete " + file1 + "| echo -";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f3, null);
   String expectedOutput = "-";
   assertEquals(expectedOutput, output);
   file1.mkdir();
 }
Пример #10
0
 @Test
 public void testDelete2() {
   String commandline = "delete testFolder2 | move " + file1 + " " + file2;
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   pipingTool.execute(f1, null);
   assertFalse(file1.exists());
   assertTrue(file2.exists());
   f2.mkdirs();
 }