コード例 #1
0
 @Before
 public void setUpStreams() {
   System.setOut(new PrintStream(outContent));
   System.setErr(new PrintStream(errContent));
   jcon = JConsole.instance();
   jcon.setCurrentDir(curDir);
   LSCom.setConsole(jcon);
 }
コード例 #2
0
  @Test
  public void LSComCDTest() {
    try {

      String cdcur = "C:\\Users\\Rahul\\Desktop";
      jcon.setCurrentDir(cdcur);
      cdCom.setConsole(jcon);

      String[] args2 = {cdcur};
      cdCom.execute(args2);
      File newFileDir = cdCom.getCurrentDir();
      String newDir = newFileDir.toString();
      //	boolean cond=newDir.equals("C:\\Users\\Rahul\\Desktop");

      String[] args1 = new String[0];
      LSCom.execute(args1);
      String output = outContent.toString();
      int count = output.length();
      System.out.println("Count :" + count);
      boolean condition = output.contains("Maven");
      Assert.assertTrue(condition);
    } catch (CommandFailedException e) {
      e.printStackTrace();
      fail("Exception was thrown");
    }
    outContent.reset();
  }