Exemple #1
0
 private void invokeValidatorsOnClass(List<Throwable> errors) {
   Annotation[] annotations = getTestClass().getAnnotations();
   for (Annotation annotation : annotations) {
     Class<? extends Annotation> annotationType = annotation.annotationType();
     ValidateWith validateWithAnnotation = annotationType.getAnnotation(ValidateWith.class);
     if (validateWithAnnotation != null) {
       AnnotationValidator annotationValidator =
           fAnnotationValidatorFactory.createAnnotationValidator(validateWithAnnotation);
       errors.addAll(annotationValidator.validateAnnotatedClass(getTestClass()));
     }
   }
 }
Exemple #2
0
 private void invokeValidatorsOnFields(List<Throwable> errors) {
   Map<Class<? extends Annotation>, List<FrameworkField>> annotationMap =
       getTestClass().getAnnotationToFields();
   for (Class<? extends Annotation> annotationType : annotationMap.keySet()) {
     ValidateWith validateWithAnnotation = annotationType.getAnnotation(ValidateWith.class);
     if (validateWithAnnotation != null) {
       for (FrameworkField frameworkField : annotationMap.get(annotationType)) {
         AnnotationValidator annotationValidator =
             fAnnotationValidatorFactory.createAnnotationValidator(validateWithAnnotation);
         errors.addAll(annotationValidator.validateAnnotatedField(frameworkField));
       }
     }
   }
 }