### Question:
CLIParser { public Command parse(String[] args) throws ParseException { if (args.length == 0) { throw new ParseException("missing sub-command"); } else { if (commands.containsKey(args[0])) { GnuParser parser = new GnuParser(); String[] minusCommand = new String[args.length - 1]; System.arraycopy(args, 1, minusCommand, 0, minusCommand.length); return new Command(args[0], parser.parse(commands.get(args[0]), minusCommand, commandWithArgs.get(args[0]))); } else { throw new ParseException(MessageFormat.format("invalid sub-command [{0}]", args[0])); } } } CLIParser(String cliName, String[] cliHelp); void addCommand(String command, String argsHelp, String commandHelp,
      Options commandOptions,
      boolean hasArguments); Command parse(String[] args); String shortHelp(); void showHelp(CommandLine commandLine);  }### Answer:
@Test public void testEmptyParser() throws Exception { try { CLIParser parser = new CLIParser("cli", new String[]{}); CLIParser.Command c = parser.parse(new String[]{"a"}); fail(); } catch (ParseException ex) { } }