Package org.zeroturnaround.exec

Examples of org.zeroturnaround.exec.ProcessExecutor


public class ProcessExecutorExitValueTest {

  @Test(expected=InvalidExitValueException.class)
  public void testJavaVersionExitValueCheck() throws Exception {
    new ProcessExecutor().command("java", "-version").exitValues(3).execute();
  }
View Full Code Here


    new ProcessExecutor().command("java", "-version").exitValues(3).execute();
  }

  @Test(expected=InvalidExitValueException.class)
  public void testJavaVersionExitValueCheckTimeout() throws Exception {
    new ProcessExecutor().command("java", "-version").exitValues(3).timeout(60, TimeUnit.SECONDS).execute();
  }
View Full Code Here

  public void testJavaVersionExitValueCheckTimeout() throws Exception {
    new ProcessExecutor().command("java", "-version").exitValues(3).timeout(60, TimeUnit.SECONDS).execute();
  }

  public void testNonZeroExitValueByDefault() throws Exception {
    new ProcessExecutor(exitLikeABoss(17)).execute();
  }
View Full Code Here

    new ProcessExecutor(exitLikeABoss(17)).execute();
  }

  @Test
  public void testCustomExitValueValid() throws Exception {
    new ProcessExecutor(exitLikeABoss(17)).exitValues(17).execute();
  }
View Full Code Here

    new ProcessExecutor(exitLikeABoss(17)).exitValues(17).execute();
  }

  @Test(expected=InvalidExitValueException.class)
  public void testCustomExitValueInvalid() throws Exception {
    new ProcessExecutor(exitLikeABoss(17)).exitValues(15).execute();
  }
View Full Code Here

public class ProcessExecutorMainTest {

  @Test(expected=IllegalStateException.class)
  public void testNoCommand() throws Exception {
    new ProcessExecutor().execute();
  }
View Full Code Here

    new ProcessExecutor().execute();
  }

  @Test(expected=IOException.class)
  public void testNoSuchFile() throws Exception {
    new ProcessExecutor().command("unknown command").execute();
  }
View Full Code Here

    new ProcessExecutor().command("unknown command").execute();
  }

  @Test
  public void testJavaVersion() throws Exception {
    int exit = new ProcessExecutor().command("java", "-version").execute().getExitValue();
    Assert.assertEquals(0, exit);
  }
View Full Code Here

    Assert.assertEquals(0, exit);
  }

  @Test
  public void testJavaVersionCommandSplit() throws Exception {
    int exit = new ProcessExecutor().commandSplit("java -version").execute().getExitValue();
    Assert.assertEquals(0, exit);
  }
View Full Code Here

    Assert.assertEquals(0, exit);
  }

  @Test
  public void testJavaVersionFuture() throws Exception {
    int exit = new ProcessExecutor().command("java", "-version").start().getFuture().get().getExitValue();
    Assert.assertEquals(0, exit);
  }
View Full Code Here

TOP

Related Classes of org.zeroturnaround.exec.ProcessExecutor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.