@Test public void parseCommandLineShouldReturnACommandLineWithCorrectHostOption() throws Exception { String[] arguments = { "-h", "127.0.0.1", "-p", "9999", "command", "arg1", "arg2", "arg3" }; CommandLine commandLine = ServerCmd.parseCommandLine(arguments); assertThat(commandLine.getOptionValue(ServerCmd.HOST_OPT_LONG)).isEqualTo("127.0.0.1"); }
@VisibleForTesting static CommandLine parseCommandLine(String[] args) throws ParseException { CommandLineParser parser = new DefaultParser(); CommandLine commandLine = parser.parse(createOptions(), args); if (commandLine.getArgs().length < 1) { throw new MissingCommandException(); } return commandLine; }
ServerCmd { @VisibleForTesting static CommandLine parseCommandLine(String[] args) throws ParseException { CommandLineParser parser = new DefaultParser(); CommandLine commandLine = parser.parse(createOptions(), args); if (commandLine.getArgs().length < 1) { throw new MissingCommandException(); } return commandLine; } }
ServerCmd { @VisibleForTesting static CommandLine parseCommandLine(String[] args) throws ParseException { CommandLineParser parser = new DefaultParser(); CommandLine commandLine = parser.parse(createOptions(), args); if (commandLine.getArgs().length < 1) { throw new MissingCommandException(); } return commandLine; } ServerCmd(JmxDataProbe probe, JmxMailboxProbe mailboxProbe, JmxQuotaProbe quotaProbe, JmxSieveProbe sieveProbe); }
ServerCmd { @VisibleForTesting static CommandLine parseCommandLine(String[] args) throws ParseException { CommandLineParser parser = new DefaultParser(); CommandLine commandLine = parser.parse(createOptions(), args); if (commandLine.getArgs().length < 1) { throw new MissingCommandException(); } return commandLine; } ServerCmd(JmxDataProbe probe, JmxMailboxProbe mailboxProbe, JmxQuotaProbe quotaProbe, JmxSieveProbe sieveProbe); static void main(String[] args); static void doMain(String[] args); static void executeAndOutputToStream(String[] args, PrintStream printStream); }
ServerCmd { @VisibleForTesting static CommandLine parseCommandLine(String[] args) throws ParseException { CommandLineParser parser = new DefaultParser(); CommandLine commandLine = parser.parse(createOptions(), args); if (commandLine.getArgs().length < 1) { throw new MissingCommandException(); } return commandLine; } ServerCmd(JmxDataProbe probe, JmxMailboxProbe mailboxProbe, JmxQuotaProbe quotaProbe, JmxSieveProbe sieveProbe); static void main(String[] args); static void doMain(String[] args); static void executeAndOutputToStream(String[] args, PrintStream printStream); static final String HOST_OPT_LONG; static final String HOST_OPT_SHORT; static final String PORT_OPT_LONG; static final String PORT_OPT_SHORT; }