CliRunAdapter extends CliRunSupport implements CliRun { protected void bind(OptionSet optionSet) { } protected  CliRunAdapter(); protected  CliRunAdapter(String command); @Override void execute(); @Override int getId(); @Override void setId(int id); @Override String getName(); @Override void setName(String name); @Override String getDescription(); @Override void setDescription(String description); @Override boolean isRequired(); @Override void setRequired(boolean required); @Override void addOptionValidator(OptionValidator optionValidator); @Override void addOptionProcessor(OptionProcessor optionProcessor); @Override void removeOptionProcessor(OptionProcessor optionProcessor); @Override Collection<OptionProcessor> getOptionProcessors(); @Override void setOptionProcessors(Collection<OptionProcessor> optionProcessors); @Override Set<String> getPrefixes(); @Override void addTrigger(Trigger trigger); @Override void addTrigger(Trigger trigger, int priority); @Override PrioritySet<Trigger> getTriggers(); @Override Option findOption(String trigger); @Override Option findOption(Trigger trigger); @Override void defaults(CommandLine commandLine); @Override boolean isCommand(String argument); @Override boolean canProcess(CommandLine commandLine, String argument); @Override boolean canProcess(CommandLine commandLine, ListIterator<String> arguments); @Override void preProcess(CommandLine commandLine, ListIterator<String> arguments); @Override void process(CommandLine commandLine, ListIterator<String> arguments); @Override void postProcess(CommandLine commandLine); @Override void setOptionFormat(OptionFormat optionFormat); @Override void help(StringBuilder buffer, Collection<HelpHint> hints, Comparator<Option> comparator); @Override List<Help> help(int indent, Collection<HelpHint> hints, Comparator<Option> comparator); @Override String getCommand(); void setCommand(String command);  }
@Test public void testBind() { Option option = cliRunAdapter.getOption(); doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { ListIterator<String> arguments = (ListIterator<String>) invocation.getArguments()[1]; return arguments.hasNext(); } }).when(option).canProcess(any(CommandLine.class), any(ListIterator.class)); doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { ListIterator<String> arguments = (ListIterator<String>) invocation.getArguments()[1]; arguments.remove(); return null; } }).when(option).process(any(CommandLine.class), any(ListIterator.class)); OptionSet optionSet = parser.parse(new String[] { "--option" }, cliRunAdapter); verify(cliRunAdapter).bind(optionSet); }