Search in sources :

Example 6 with RequiredFieldValidator

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);
}
Also used : DateRangeFieldValidator(com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator) StringLengthFieldValidator(com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator) DoubleRangeFieldValidator(com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator) IntRangeFieldValidator(com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator) RequiredFieldValidator(com.opensymphony.xwork2.validator.validators.RequiredFieldValidator) List(java.util.List) RequiredFieldValidator(com.opensymphony.xwork2.validator.validators.RequiredFieldValidator) RequiredStringValidator(com.opensymphony.xwork2.validator.validators.RequiredStringValidator)

Aggregations

TextProviderFactory (com.opensymphony.xwork2.TextProviderFactory)3 DummyValidatorContext (com.opensymphony.xwork2.validator.DummyValidatorContext)3 RequiredFieldValidator (com.opensymphony.xwork2.validator.validators.RequiredFieldValidator)3 RequiredStringValidator (com.opensymphony.xwork2.validator.validators.RequiredStringValidator)3 Test (org.junit.Test)3 DateRangeFieldValidator (com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator)2 DoubleRangeFieldValidator (com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator)2 IntRangeFieldValidator (com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator)2 StringLengthFieldValidator (com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator)2 List (java.util.List)2 ValueStack (com.opensymphony.xwork2.util.ValueStack)1 ValueStackFactory (com.opensymphony.xwork2.util.ValueStackFactory)1 EmailValidator (com.opensymphony.xwork2.validator.validators.EmailValidator)1 ExpressionValidator (com.opensymphony.xwork2.validator.validators.ExpressionValidator)1 URLValidator (com.opensymphony.xwork2.validator.validators.URLValidator)1 VisitorFieldValidator (com.opensymphony.xwork2.validator.validators.VisitorFieldValidator)1 ArrayList (java.util.ArrayList)1