JsignCLI { public static void main(String... args) { try { new JsignCLI().execute(args); } catch (SignerException | ParseException e) { System.err.println("jsign: " + e.getMessage()); if (e.getCause() != null) { e.getCause().printStackTrace(System.err); } System.err.println("Try `" + getProgramName() + " --help' for more information."); System.exit(1); } } JsignCLI(); static void main(String... args);  }
@Test public void testExitOnError() { NoExitSecurityManager manager = new NoExitSecurityManager(); System.setSecurityManager(manager); try { JsignCLI.main("foo.exe"); fail("VM not terminated"); } catch (SecurityException e) { assertEquals("Exit code", Integer.valueOf(1), manager.getStatus()); } finally { System.setSecurityManager(null); } }