@Test public void multiple_constraints() { PropertyConduit conduit = mockPropertyConduit(); Validate validate = newValidate("required,minlength=3,regexp=^([a-zA-Z0-9]{2,4})+$"); train_getAnnotation(conduit, Validate.class, validate); replay(); ValidationConstraintGenerator gen = new ValidateAnnotationConstraintGenerator(); assertEquals(gen.buildConstraints(null, conduit), Arrays.asList("required", "minlength=3", "regexp=^([a-zA-Z0-9]{2,4})+$")); verify(); }
public List<String> buildConstraints(Class propertyType, AnnotationProvider annotationProvider) { Validate annotation = annotationProvider.getAnnotation(Validate.class); if (annotation == null) return null; return Arrays.asList(validatorPattern.split(annotation.value())); }
ValidateAnnotationConstraintGenerator implements ValidationConstraintGenerator { public List<String> buildConstraints(Class propertyType, AnnotationProvider annotationProvider) { Validate annotation = annotationProvider.getAnnotation(Validate.class); if (annotation == null) return null; return Arrays.asList(validatorPattern.split(annotation.value())); } }
ValidateAnnotationConstraintGenerator implements ValidationConstraintGenerator { public List<String> buildConstraints(Class propertyType, AnnotationProvider annotationProvider) { Validate annotation = annotationProvider.getAnnotation(Validate.class); if (annotation == null) return null; return Arrays.asList(validatorPattern.split(annotation.value())); } ValidateAnnotationConstraintGenerator(); }
ValidateAnnotationConstraintGenerator implements ValidationConstraintGenerator { public List<String> buildConstraints(Class propertyType, AnnotationProvider annotationProvider) { Validate annotation = annotationProvider.getAnnotation(Validate.class); if (annotation == null) return null; return Arrays.asList(validatorPattern.split(annotation.value())); } ValidateAnnotationConstraintGenerator(); List<String> buildConstraints(Class propertyType, AnnotationProvider annotationProvider); }
ValidateAnnotationConstraintGenerator implements ValidationConstraintGenerator { public List<String> buildConstraints(Class propertyType, AnnotationProvider annotationProvider) { Validate annotation = annotationProvider.getAnnotation(Validate.class); if (annotation == null) return null; return Arrays.asList(validatorPattern.split(annotation.value())); } ValidateAnnotationConstraintGenerator(); List<String> buildConstraints(Class propertyType, AnnotationProvider annotationProvider);  }