// Test case pass.
assertTrue(determineFailedValidation(validate(createOptionInstance(option, "value"))).isEmpty());
}
public void testHandle() {
CmdLineAction action = createAction("testAction");
action.setDescription("test description");
AdvancedCmdLineOption option = new AdvancedCmdLineOption("t", "test", "",
true);
// Insure runs with no errors when action doesn't have a handler.
CmdLineUtils.handle(action, createOptionInstance(option));
// Test case when option has a handler.
option.setHandler(new CmdLineOptionHandler() {
@Override
public void initialize(CmdLineOption option) {}
@Override
public void handleOption(CmdLineAction selectedAction,
CmdLineOptionInstance optionInstance) {
selectedAction.setDescription("handler modified description");
}
@Override
public String getHelp(CmdLineOption option) {
return null;
}
@Override
public String getArgDescription(CmdLineAction action,
CmdLineOption option) {
return null;
}
});
CmdLineUtils.handle(action, createOptionInstance(option));
assertEquals("handler modified description", action.getDescription());
}