PMDCommandLineInterface { public static void setStatusCodeOrExit(int status) { if (isExitAfterRunSet()) { System.exit(status); } else { setStatusCode(status); } } private  PMDCommandLineInterface(); static PMDParameters extractParameters(PMDParameters arguments, String[] args, String progName); static String buildUsageText(); @Deprecated static String buildUsageText(JCommander jcommander); static void main(String[] args); static String jarName(); static void run(String[] args); static void setStatusCodeOrExit(int status); static final String PROG_NAME; static final String NO_EXIT_AFTER_RUN; static final String STATUS_CODE_PROPERTY; static final int NO_ERRORS_STATUS; static final int ERROR_STATUS; static final int VIOLATIONS_FOUND; }
@Test public void testSetStatusCodeOrExitDoExit() { exit.expectSystemExitWithStatus(0); PMDCommandLineInterface.setStatusCodeOrExit(0); }
@Test public void testSetStatusCodeOrExitSetStatus() { System.setProperty(PMDCommandLineInterface.NO_EXIT_AFTER_RUN, "1"); PMDCommandLineInterface.setStatusCodeOrExit(0); Assert.assertEquals(System.getProperty(PMDCommandLineInterface.STATUS_CODE_PROPERTY), "0"); }