@Test public void recursive_macros_are_caught() { ValidatorMacro macro = mockValidatorMacro(); expect(macro.valueForMacro("combo")).andReturn("required,combo"); expect(macro.valueForMacro("required")).andReturn(null); expect(macro.valueForMacro("combo")).andReturn("required,combo"); replay(); FieldValidatorSourceImpl source = new FieldValidatorSourceImpl(null, null, null, null, macro); try { source.toValidatorSpecifications("combo"); unreachable(); } catch (RuntimeException ex) { assertEquals(ex.getMessage(), "Validator macro 'combo' appears more than once."); } 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);  }