AgentLauncher { @SuppressWarnings("PMD.ExceptionAsFlowControl") public static void main(String... args) { OptionsAndArgs options; try { options = new OptionsAndArgs(CommandDispatcher.getAvailableCommands(),args); VirtualMachineHandler vmHandler = new VirtualMachineHandler(options); CommandDispatcher dispatcher = new CommandDispatcher(options); Object vm = options.needsVm() ? vmHandler.attachVirtualMachine() : null; int exitCode = 0; try { exitCode = dispatcher.dispatchCommand(vm,vmHandler); } catch (InvocationTargetException e) { throw new ProcessingException("InvocationTargetException",e,options); } catch (NoSuchMethodException e) { throw new ProcessingException("Internal: NoSuchMethod",e,options); } catch (IllegalAccessException e) { throw new ProcessingException("IllegalAccess",e,options); } finally { if (vm != null) { vmHandler.detachAgent(vm); } } System.exit(exitCode); } catch (IllegalArgumentException exp) { System.err.println("Error: " + exp.getMessage() + "\n"); CommandDispatcher.printHelp(); System.exit(1); } catch (ProcessingException exp) { exp.printErrorMessage(); System.exit(1); } } private  AgentLauncher(); @SuppressWarnings("PMD.ExceptionAsFlowControl") static void main(String... args);  }
@Test(enabled = false) public void simple() { forbidSystemExitCall(); try { AgentLauncher.main(); } catch (ExitTrappedException exp) { } finally { enableSystemExitCall(); } }