JoptCli implements Cli { @Override public String commandName() { return commandName; } JoptCli(OptionSet parsed, String commandName); @Override String commandName(); @Override boolean hasOption(String optionName); @Override List<String> optionStrings(String name); @SuppressWarnings("unchecked") @Override List<String> standaloneArguments(); @Override List<OptionSpec<?>> detectedOptions();  }
@Test public void testCommandName() { JoptCli o1 = new JoptCli(mockParsed, "aname"); assertEquals("aname", o1.commandName()); JoptCli o2 = new JoptCli(mockParsed, null); assertNull(o2.commandName()); }