JoptCli implements Cli { @Override public List<String> optionStrings(String name) { return optionSet.valuesOf(name).stream().map(String::valueOf).collect(toList()); } 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 testStringsFor_Missing() { when(mockParsed.valueOf(anyString())).thenReturn(Collections.emptyList()); JoptCli opts = new JoptCli(mockParsed, "aname"); assertNotNull(opts.optionStrings("no_such_opt")); assertEquals(0, opts.optionStrings("no_such_opt").size()); }