} catch (InvalidParameterValueException e) {
}
// restrict our command to only a certain set of parameters
m_cmd.setParameterDefinitions(new ParameterDefinition[] {
new ParameterDefinition("string", "java.lang.String", true, false, false, ""),
new ParameterDefinition("int", "java.lang.Integer", true, true, false, "") });
m_cmd.checkParameterValidity(false);
// change nullable field
m_cmd.setParameterDefinitions(new ParameterDefinition[] {
new ParameterDefinition("string", "java.lang.String", true, false, false, ""),
new ParameterDefinition("int", "java.lang.Integer", true, false, false, "") });
try {
m_cmd.checkParameterValidity(false);
fail("Should not have allowed a null int param - InvalidParameterValueException should have been thrown");
} catch (InvalidParameterValueException e) {
}
// add a new required field
m_cmd.setParameterDefinitions(new ParameterDefinition[] {
new ParameterDefinition("another", "java.lang.String", true, false, false, ""),
new ParameterDefinition("string", "java.lang.String", true, false, false, ""),
new ParameterDefinition("int", "java.lang.Integer", true, true, false, "") });
try {
m_cmd.checkParameterValidity(false);
fail("Should have required 'another' param - InvalidParameterValueException should have been thrown");
} catch (InvalidParameterValueException e) {
}
// change that new required field to optional
m_cmd.setParameterDefinitions(new ParameterDefinition[] {
new ParameterDefinition("another", "java.lang.String", false, false, false, ""),
new ParameterDefinition("string", "java.lang.String", true, false, false, ""),
new ParameterDefinition("int", "java.lang.Integer", true, true, false, "") });
m_cmd.checkParameterValidity(false);
// change back to allowing all params
m_cmd.setParameterDefinitions(null);
assertTrue(m_cmd.allowAnyParameter());