@Test public void single_constraint() { PropertyConduit conduit = mockPropertyConduit(); Validate validate = newValidate("required"); train_getAnnotation(conduit, Validate.class, validate); replay(); ValidationConstraintGenerator gen = new ValidateAnnotationConstraintGenerator(); assertEquals(gen.buildConstraints(Object.class, conduit), Arrays.asList("required")); 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);  }