CmdLineUtils.getOptionByName(actionOption.getLongOption(), options));
}
public void testGetOptionInstanceByName() {
CmdLineAction action = createAction("action");
CmdLineOptionInstance userOptionInst, urlOptionInst, passOptionInst, actionOptionInst;
HashSet<CmdLineOptionInstance> optionInsts = Sets.newHashSet(
userOptionInst = new CmdLineOptionInstance(createSimpleOption(
"user", "username", false), new ArrayList<String>()),
urlOptionInst = new CmdLineOptionInstance(createSimpleOption("u",
"url", createRequiredRequirementRule(action)),
new ArrayList<String>()),
passOptionInst = new CmdLineOptionInstance(createSimpleOption(
"pass", "password", false), new ArrayList<String>()),
actionOptionInst = new CmdLineOptionInstance(
createActionOption("action"), new ArrayList<String>()));
assertEquals(userOptionInst, CmdLineUtils.getOptionInstanceByName(
userOptionInst.getOption().getShortOption(), optionInsts));
assertEquals(userOptionInst, CmdLineUtils.getOptionInstanceByName(
userOptionInst.getOption().getLongOption(), optionInsts));
assertEquals(urlOptionInst, CmdLineUtils.getOptionInstanceByName(
urlOptionInst.getOption().getShortOption(), optionInsts));
assertEquals(urlOptionInst, CmdLineUtils.getOptionInstanceByName(
urlOptionInst.getOption().getLongOption(), optionInsts));
assertEquals(passOptionInst, CmdLineUtils.getOptionInstanceByName(