@Test public void testWrongServiceName() { systemExitCapturer.runAndAssertExitCode(() -> tlsToolkitMain.doMain(new String[] {"fakeService"}), ExitCode.INVALID_ARGS); }
public void doMain(String[] args) { if (args.length < 1) { printUsageAndExit("Expected at least a service argument.", ExitCode.INVALID_ARGS); } String service = args[0].toLowerCase(); try { getMain(service).invoke(null, (Object) Arrays.copyOfRange(args, 1, args.length, String[].class)); } catch (IllegalAccessException e) { printUsageAndExit("Service " + service + " has invalid main method.", ExitCode.SERVICE_ERROR); } catch (InvocationTargetException e) { printUsageAndExit("Service " + service + " error: " + e.getCause().getMessage(), ExitCode.SERVICE_ERROR); } return; }
TlsToolkitMain { public void doMain(String[] args) { if (args.length < 1) { printUsageAndExit("Expected at least a service argument.", ExitCode.INVALID_ARGS); } String service = args[0].toLowerCase(); try { getMain(service).invoke(null, (Object) Arrays.copyOfRange(args, 1, args.length, String[].class)); } catch (IllegalAccessException e) { printUsageAndExit("Service " + service + " has invalid main method.", ExitCode.SERVICE_ERROR); } catch (InvocationTargetException e) { printUsageAndExit("Service " + service + " error: " + e.getCause().getMessage(), ExitCode.SERVICE_ERROR); } return; } }
TlsToolkitMain { public void doMain(String[] args) { if (args.length < 1) { printUsageAndExit("Expected at least a service argument.", ExitCode.INVALID_ARGS); } String service = args[0].toLowerCase(); try { getMain(service).invoke(null, (Object) Arrays.copyOfRange(args, 1, args.length, String[].class)); } catch (IllegalAccessException e) { printUsageAndExit("Service " + service + " has invalid main method.", ExitCode.SERVICE_ERROR); } catch (InvocationTargetException e) { printUsageAndExit("Service " + service + " error: " + e.getCause().getMessage(), ExitCode.SERVICE_ERROR); } return; } TlsToolkitMain(); }
TlsToolkitMain { public void doMain(String[] args) { if (args.length < 1) { printUsageAndExit("Expected at least a service argument.", ExitCode.INVALID_ARGS); } String service = args[0].toLowerCase(); try { getMain(service).invoke(null, (Object) Arrays.copyOfRange(args, 1, args.length, String[].class)); } catch (IllegalAccessException e) { printUsageAndExit("Service " + service + " has invalid main method.", ExitCode.SERVICE_ERROR); } catch (InvocationTargetException e) { printUsageAndExit("Service " + service + " error: " + e.getCause().getMessage(), ExitCode.SERVICE_ERROR); } return; } TlsToolkitMain(); static void main(String[] args); void doMain(String[] args); }
TlsToolkitMain { public void doMain(String[] args) { if (args.length < 1) { printUsageAndExit("Expected at least a service argument.", ExitCode.INVALID_ARGS); } String service = args[0].toLowerCase(); try { getMain(service).invoke(null, (Object) Arrays.copyOfRange(args, 1, args.length, String[].class)); } catch (IllegalAccessException e) { printUsageAndExit("Service " + service + " has invalid main method.", ExitCode.SERVICE_ERROR); } catch (InvocationTargetException e) { printUsageAndExit("Service " + service + " error: " + e.getCause().getMessage(), ExitCode.SERVICE_ERROR); } return; } TlsToolkitMain(); static void main(String[] args); void doMain(String[] args); static final String DESCRIPTION; static final String UNABLE_TO_GET_DESCRIPTION; }