@SuppressWarnings("unchecked") @Test public void simple_macro_expansion() throws Exception { ValidatorMacro macro = mockValidatorMacro(); expect(macro.valueForMacro("combo")).andReturn("required,minlength=5"); expect(macro.valueForMacro("required")).andReturn(null); expect(macro.valueForMacro("minlength")).andReturn(null); replay(); FieldValidatorSourceImpl source = new FieldValidatorSourceImpl(null, null, null, null, macro); List<ValidatorSpecification> specs = source.toValidatorSpecifications("combo"); assertListsEquals(specs, new ValidatorSpecification("required"), new ValidatorSpecification("minlength", "5")); verify(); }
List<ValidatorSpecification> toValidatorSpecifications(String specification) { return expandMacros(parse(specification)); }
FieldValidatorSourceImpl implements FieldValidatorSource { List<ValidatorSpecification> toValidatorSpecifications(String specification) { return expandMacros(parse(specification)); } }
FieldValidatorSourceImpl implements FieldValidatorSource { List<ValidatorSpecification> toValidatorSpecifications(String specification) { return expandMacros(parse(specification)); } FieldValidatorSourceImpl(Messages globalMessages, TypeCoercer typeCoercer,
                                    FormSupport formSupport, Map<String, Validator> validators, ValidatorMacro validatorMacro); }
FieldValidatorSourceImpl implements FieldValidatorSource { List<ValidatorSpecification> toValidatorSpecifications(String specification) { return expandMacros(parse(specification)); } FieldValidatorSourceImpl(Messages globalMessages, TypeCoercer typeCoercer,
                                    FormSupport formSupport, Map<String, Validator> validators, ValidatorMacro validatorMacro); FieldValidator createValidator(Field field, String validatorType, String constraintValue); FieldValidator createValidator(Field field, String validatorType, String constraintValue, String overrideId,
                                          Messages overrideMessages, Locale locale); FieldValidator createValidators(Field field, String specification); }
FieldValidatorSourceImpl implements FieldValidatorSource { List<ValidatorSpecification> toValidatorSpecifications(String specification) { return expandMacros(parse(specification)); } FieldValidatorSourceImpl(Messages globalMessages, TypeCoercer typeCoercer,
                                    FormSupport formSupport, Map<String, Validator> validators, ValidatorMacro validatorMacro); FieldValidator createValidator(Field field, String validatorType, String constraintValue); FieldValidator createValidator(Field field, String validatorType, String constraintValue, String overrideId,
                                          Messages overrideMessages, Locale locale); FieldValidator createValidators(Field field, String specification);  }