### Question:
CLIExceptionCapturer implements CommandLine.IExecutionExceptionHandler, CommandLine.IParameterExceptionHandler { @Override public int handleParseException(final CommandLine.ParameterException ex, final String[] args) { if (ex.getCause() == null) { final CommandLine cmd = ex.getCommandLine(); final PrintWriter writer = cmd.getErr(); writer.println(ex.getMessage()); cmd.usage(writer); } this.thrown = (Exception) ex.getCause(); return 0; }  @Override int handleExecutionException(
            final Exception ex, final CommandLine cmd, final CommandLine.ParseResult result); @Override int handleParseException(final CommandLine.ParameterException ex, final String[] args); Exception getThrown();  }### Answer:
@Test public void exceptionWithoutCausePrintsUsage() { final CommandLine cmd = mock(CommandLine.class); final PrintWriter writer = mock(PrintWriter.class); when(cmd.getErr()).thenReturn(writer); final CommandLine.ParameterException ex = new CommandLine.ParameterException(cmd, "test-message", null); capturer.handleParseException(ex, new String[0]); verify(cmd).getErr(); verify(cmd).usage(writer); verify(writer).println("test-message"); }