options.add(helpOption);
assertEquals(helpOption, CmdLineUtils.findHelpOption(options));
}
public void testFindSpecifiedHelpOption() {
CmdLineOptionInstance helpOption = createOptionInstance(new HelpCmdLineOption());
Set<CmdLineOptionInstance> options = Sets.newHashSet(
createOptionInstance(createSimpleOption("test", false)),
createOptionInstance(createSimpleOption("test", false)));
assertNull(findSpecifiedHelpOption(options));
options.add(helpOption);
assertEquals(helpOption, findSpecifiedHelpOption(options));
options.add(createOptionInstance(new HelpCmdLineOption("h2", "help2", "Second Help Option", true)));
try {
findSpecifiedHelpOption(options);
fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException ignore) { /* expect throw */ }
}