use of com.opensymphony.xwork2.validator.validators.RequiredFieldValidator in project struts by apache.
the class AnnotationActionValidatorManagerTest method testGetValidatorsForInterface.
public void testGetValidatorsForInterface() {
List validatorList = annotationActionValidatorManager.getValidators(AnnotationDataAware2.class, alias);
// 1 in interface hierarchy, 2 from parent interface (1 default + 1 context)
assertEquals(3, validatorList.size());
final FieldValidator dataValidator1 = (FieldValidator) validatorList.get(0);
assertEquals("data", dataValidator1.getFieldName());
assertTrue(dataValidator1 instanceof RequiredFieldValidator);
final FieldValidator dataValidator2 = (FieldValidator) validatorList.get(1);
assertEquals("data", dataValidator2.getFieldName());
assertTrue(dataValidator2 instanceof RequiredStringValidator);
final FieldValidator blingValidator = (FieldValidator) validatorList.get(2);
assertEquals("bling", blingValidator.getFieldName());
assertTrue(blingValidator instanceof RequiredStringValidator);
}
Aggregations