@Test public void testInitNetworkInvalidOptions() throws Exception { Command command = INIT_NETWORK; String invalidOption = "-setnetwork"; String[] args = new String[] {invalidOption, "parameter1"}; CommandUsage usage = Command.getUsageMap().get(command); String expected = String.format( "Invalid arguments: %s %s\n%s %s\n\t%s\n\n", "[-setnetwork]", "[parameter1]", command.commandName(), usage.getUsage(), usage.getDescription()); checkProcessCommandErrorMessage(command, args, expected); }
private boolean get( String[] words, @Nullable FileWriter outWriter, List<String> options, List<String> parameters) { if (!isValidArgument(options, parameters, 0, 1, Integer.MAX_VALUE, Command.GET)) { return false; } if (!isSetTestrig() || !isSetContainer(true)) { return false; } String qTypeStr = parameters.get(0).toLowerCase(); String paramsLine = String.join(" ", Arrays.copyOfRange(words, 2 + options.size(), words.length)); return answerType(qTypeStr, paramsLine, outWriter); }
Client extends AbstractClient implements IClient { private boolean get( String[] words, @Nullable FileWriter outWriter, List<String> options, List<String> parameters) { if (!isValidArgument(options, parameters, 0, 1, Integer.MAX_VALUE, Command.GET)) { return false; } if (!isSetTestrig() || !isSetContainer(true)) { return false; } String qTypeStr = parameters.get(0).toLowerCase(); String paramsLine = String.join(" ", Arrays.copyOfRange(words, 2 + options.size(), words.length)); return answerType(qTypeStr, paramsLine, outWriter); } }
Client extends AbstractClient implements IClient { private boolean get( String[] words, @Nullable FileWriter outWriter, List<String> options, List<String> parameters) { if (!isValidArgument(options, parameters, 0, 1, Integer.MAX_VALUE, Command.GET)) { return false; } if (!isSetTestrig() || !isSetContainer(true)) { return false; } String qTypeStr = parameters.get(0).toLowerCase(); String paramsLine = String.join(" ", Arrays.copyOfRange(words, 2 + options.size(), words.length)); return answerType(qTypeStr, paramsLine, outWriter); } Client(Settings settings);  Client(String[] args); }
Client extends AbstractClient implements IClient { private boolean get( String[] words, @Nullable FileWriter outWriter, List<String> options, List<String> parameters) { if (!isValidArgument(options, parameters, 0, 1, Integer.MAX_VALUE, Command.GET)) { return false; } if (!isSetTestrig() || !isSetContainer(true)) { return false; } String qTypeStr = parameters.get(0).toLowerCase(); String paramsLine = String.join(" ", Arrays.copyOfRange(words, 2 + options.size(), words.length)); return answerType(qTypeStr, paramsLine, outWriter); } Client(Settings settings);  Client(String[] args); @Override BatfishLogger getLogger(); Settings getSettings(); void run(List<String> initialCommands); }
Client extends AbstractClient implements IClient { private boolean get( String[] words, @Nullable FileWriter outWriter, List<String> options, List<String> parameters) { if (!isValidArgument(options, parameters, 0, 1, Integer.MAX_VALUE, Command.GET)) { return false; } if (!isSetTestrig() || !isSetContainer(true)) { return false; } String qTypeStr = parameters.get(0).toLowerCase(); String paramsLine = String.join(" ", Arrays.copyOfRange(words, 2 + options.size(), words.length)); return answerType(qTypeStr, paramsLine, outWriter); } Client(Settings settings);  Client(String[] args); @Override BatfishLogger getLogger(); Settings getSettings(); void run(List<String> initialCommands);  }