Tabnine Logo
CommandLine$ExecutionException.getCause
Code IndexAdd Tabnine to your IDE (free)

How to use
getCause
method
in
picocli.CommandLine$ExecutionException

Best Java code snippets using picocli.CommandLine$ExecutionException.getCause (Showing top 12 results out of 315)

origin: remkop/picocli

@Test
public void testCallWithFactory() {
  Runnable[] variations = new Runnable[] {
      new Runnable() {public void run() {CommandLine.call(MyCallable.class, new InnerClassFactory(this), "-x", "a");}},
      new Runnable() {public void run() {CommandLine.call(MyCallable.class, new InnerClassFactory(this), System.out, "-x", "a");}},
      new Runnable() {public void run() {CommandLine.call(MyCallable.class, new InnerClassFactory(this), System.out, Help.Ansi.OFF, "-x", "a");}},
      new Runnable() {public void run() {CommandLine.call(MyCallable.class, new InnerClassFactory(this), System.out, System.out, Help.Ansi.OFF, "-x", "a");}},
  };
  for (Runnable r : variations) {
    try {
      r.run();
    } catch (ExecutionException ex) {
      assertTrue(ex.getMessage().startsWith("Error while calling command (picocli.CommandLineParseWithHandlersTest$MyCallable"));
      assertTrue(ex.getCause() instanceof IllegalStateException);
      assertEquals("this is a test", ex.getCause().getMessage());
    }
  }
}
origin: remkop/picocli

@Test
public void testRunWithFactory() {
  Runnable[] variations = new Runnable[] {
      new Runnable() {public void run() {CommandLine.run(MyRunnable.class, new InnerClassFactory(this), "-x", "a");}},
      new Runnable() {public void run() {CommandLine.run(MyRunnable.class, new InnerClassFactory(this), System.out, "-x", "a");}},
      new Runnable() {public void run() {CommandLine.run(MyRunnable.class, new InnerClassFactory(this), System.out, Help.Ansi.OFF, "-x", "a");}},
      new Runnable() {public void run() {CommandLine.run(MyRunnable.class, new InnerClassFactory(this), System.out, System.out, Help.Ansi.OFF, "-x", "a");}},
  };
  for (Runnable r : variations) {
    try {
      r.run();
    } catch (ExecutionException ex) {
      assertTrue(ex.getMessage(), ex.getMessage().startsWith("Error while running command (picocli.CommandLineParseWithHandlersTest$MyRunnable"));
      assertTrue(ex.getCause() instanceof IllegalStateException);
      assertEquals("this is a test", ex.getCause().getMessage());
    }
  }
}
origin: remkop/picocli

@Test
public void testCommandMethodsWhereConstructorThrowsException() {
  try {
    CommandLine.invoke("cannotBeCalled", ErroringCommand.class);
  } catch (ExecutionException ex) { // InvocationTargetException when invoking constructor
    assertTrue(ex.getCause() instanceof IllegalStateException);
    assertTrue(ex.getMessage(), ex.getMessage().startsWith("Error while calling command ("));
  }
}
origin: hazelcast/hazelcast-jet

  @Override
  public R handleExecutionException(ExecutionException ex, ParseResult parseResult) {
    // find top level command
    CommandLine cmdLine = ex.getCommandLine();
    while (cmdLine.getParent() != null) {
      cmdLine = cmdLine.getParent();
    }
    JetCommandLine jetCmd = cmdLine.getCommand();
    if (jetCmd.isVerbose) {
      ex.printStackTrace(err());
    } else {
      err().println("ERROR: " + ex.getCause().getMessage());
      err().println();
      err().println("To see the full stack trace, re-run with the -v/--verbose option");
    }
    if (hasExitCode()) {
      exit(exitCode());
    }
    throw ex;
  }
}
origin: info.picocli/picocli

@Test
public void testCallWithFactory() {
  Runnable[] variations = new Runnable[] {
      new Runnable() {public void run() {CommandLine.call(MyCallable.class, new InnerClassFactory(this), "-x", "a");}},
      new Runnable() {public void run() {CommandLine.call(MyCallable.class, new InnerClassFactory(this), System.out, "-x", "a");}},
      new Runnable() {public void run() {CommandLine.call(MyCallable.class, new InnerClassFactory(this), System.out, Help.Ansi.OFF, "-x", "a");}},
      new Runnable() {public void run() {CommandLine.call(MyCallable.class, new InnerClassFactory(this), System.out, System.out, Help.Ansi.OFF, "-x", "a");}},
  };
  for (Runnable r : variations) {
    try {
      r.run();
    } catch (ExecutionException ex) {
      assertTrue(ex.getMessage().startsWith("Error while calling command (picocli.CommandLineParseWithHandlersTest$MyCallable"));
      assertTrue(ex.getCause() instanceof IllegalStateException);
      assertEquals("this is a test", ex.getCause().getMessage());
    }
  }
}
origin: info.picocli/picocli

@Test
public void testRunWithFactory() {
  Runnable[] variations = new Runnable[] {
      new Runnable() {public void run() {CommandLine.run(MyRunnable.class, new InnerClassFactory(this), "-x", "a");}},
      new Runnable() {public void run() {CommandLine.run(MyRunnable.class, new InnerClassFactory(this), System.out, "-x", "a");}},
      new Runnable() {public void run() {CommandLine.run(MyRunnable.class, new InnerClassFactory(this), System.out, Help.Ansi.OFF, "-x", "a");}},
      new Runnable() {public void run() {CommandLine.run(MyRunnable.class, new InnerClassFactory(this), System.out, System.out, Help.Ansi.OFF, "-x", "a");}},
  };
  for (Runnable r : variations) {
    try {
      r.run();
    } catch (ExecutionException ex) {
      assertTrue(ex.getMessage(), ex.getMessage().startsWith("Error while running command (picocli.CommandLineParseWithHandlersTest$MyRunnable"));
      assertTrue(ex.getCause() instanceof IllegalStateException);
      assertEquals("this is a test", ex.getCause().getMessage());
    }
  }
}
origin: info.picocli/picocli

@Test
public void testCommandMethodsThatThrowsException() {
  try {
    CommandLine.invoke("throwsOtherException", StaticMethodCommand.class);
  } catch (ExecutionException ex) {
    assertTrue(ex.getCause() instanceof IndexOutOfBoundsException);
  }
}
origin: info.picocli/picocli

@Test
public void testCommandMethodsRequireNonArgConstructor() {
  try {
    CommandLine.invoke("cannotBeCalled", StaticMethodCommand.class);
  } catch (ExecutionException ex) {
    assertTrue(ex.getCause() instanceof UnsupportedOperationException);
  }
}
origin: com.intuit.karate/karate-netty

  @Override
  public Object handleExecutionException(ExecutionException ex, ParseResult parseResult) {
    if (ex.getCause() instanceof KarateException) {
      throw new ExecutionException(cmd, ex.getCause().getMessage()); // minimum possible stack trace but exit code 1
    } else {
      throw ex;
    }
  }
};
origin: info.picocli/picocli

@Test
public void testCommandMethodsWhereConstructorThrowsException() {
  try {
    CommandLine.invoke("cannotBeCalled", ErroringCommand.class);
  } catch (ExecutionException ex) { // InvocationTargetException when invoking constructor
    assertTrue(ex.getCause() instanceof IllegalStateException);
    assertTrue(ex.getMessage(), ex.getMessage().startsWith("Error while calling command ("));
  }
}
origin: remkop/picocli

@Test
public void testCommandMethodsThatThrowsException() {
  try {
    CommandLine.invoke("throwsOtherException", StaticMethodCommand.class);
  } catch (ExecutionException ex) {
    assertTrue(ex.getCause() instanceof IndexOutOfBoundsException);
  }
}
origin: remkop/picocli

@Test
public void testCommandMethodsRequireNonArgConstructor() {
  try {
    CommandLine.invoke("cannotBeCalled", StaticMethodCommand.class);
  } catch (ExecutionException ex) {
    assertTrue(ex.getCause() instanceof UnsupportedOperationException);
  }
}
picocliCommandLine$ExecutionExceptiongetCause

Popular methods of CommandLine$ExecutionException

  • <init>
  • getCommandLine
  • getMessage
  • printStackTrace

Popular in Java

  • Creating JSON documents from java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • addToBackStack (FragmentTransaction)
  • startActivity (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now