@Test @PrepareForTest({ ShipLauncher.class, System.class }) public void testExecute() { final ShipLauncher shipLauncher = spy(new ShipLauncher(DummyMessagePrinter.getInstance())); doNothing().when(shipLauncher).exit(anyInt()); final Command command = mock(Command.class); shipLauncher.execute(command); verify(shipLauncher).exit(anyInt()); }
public void execute(final Command command) { try { logger.trace("{} starting...", command); command.execute(); exit(0); } catch (final CommandException throwable) { handleCommandException(command, throwable); } catch (final Throwable throwable) { handleThrowable(command, throwable); } }
ShipLauncher { public void execute(final Command command) { try { logger.trace("{} starting...", command); command.execute(); exit(0); } catch (final CommandException throwable) { handleCommandException(command, throwable); } catch (final Throwable throwable) { handleThrowable(command, throwable); } } }
ShipLauncher { public void execute(final Command command) { try { logger.trace("{} starting...", command); command.execute(); exit(0); } catch (final CommandException throwable) { handleCommandException(command, throwable); } catch (final Throwable throwable) { handleThrowable(command, throwable); } }  }
ShipLauncher { public void execute(final Command command) { try { logger.trace("{} starting...", command); command.execute(); exit(0); } catch (final CommandException throwable) { handleCommandException(command, throwable); } catch (final Throwable throwable) { handleThrowable(command, throwable); } }  static void main(final String[] args); void exit(int returnCode); void run(final String[] args); void execute(final Command command); }
ShipLauncher { public void execute(final Command command) { try { logger.trace("{} starting...", command); command.execute(); exit(0); } catch (final CommandException throwable) { handleCommandException(command, throwable); } catch (final Throwable throwable) { handleThrowable(command, throwable); } }  static void main(final String[] args); void exit(int returnCode); void run(final String[] args); void execute(final Command command);  }