Exemplo n.º 1
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();
  }
Exemplo n.º 2
0
 @Before
 public void setUpStreams() {
   System.setOut(new PrintStream(outContent));
   System.setErr(new PrintStream(errContent));
   jcon = JConsole.instance();
   jcon.setCurrentDir(curDir);
   LSCom.setConsole(jcon);
 }
Exemplo n.º 3
0
 @Test
 public void LSComFalseTest() {
   try {
     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("Rahul.xml");
     Assert.assertFalse(condition);
   } catch (CommandFailedException e) {
     e.printStackTrace();
     fail("Exception was thrown");
   }
   outContent.reset();
 }
Exemplo n.º 4
0
 // Added by Rahul
 @Test
 public void LSComCountTest() {
   try {
     String[] args1 = new String[0];
     LSCom.execute(args1);
     String output = outContent.toString();
     int count = output.length();
     System.out.println("Count :" + count);
     //	boolean condition=(count==1704);
     Assert.assertEquals(count, 1704);
   } catch (CommandFailedException e) {
     e.printStackTrace();
     fail("Exception was thrown");
   }
   outContent.reset();
 }
Exemplo n.º 5
0
 @Test
 public void LSComTest() {
   try {
     System.out.println("hwllo");
     String[] args1 = new String[0];
     String sampleFile = "Jconsole.xml";
     LSCom.execute(args1);
     String output = outContent.toString();
     System.out.println("the out put of ls command is:" + output);
     assertTrue(output.contains(sampleFile));
   } catch (CommandFailedException e) {
     e.printStackTrace();
     fail("Exception was thrown");
   }
   outContent.reset();
 }