### Question:
ConstraintHelper { public <A extends Annotation> List<Annotation> getMultiValueConstraints(A annotation) { List<Annotation> annotationList = new ArrayList<Annotation>(); try { Method m = annotation.getClass().getMethod( "value" ); Class returnType = m.getReturnType(); if ( returnType.isArray() && returnType.getComponentType().isAnnotation() ) { Annotation[] annotations = ( Annotation[] ) m.invoke( annotation ); for ( Annotation a : annotations ) { if ( isConstraintAnnotation( a ) || isBuiltinConstraint( a.annotationType() ) ) { annotationList.add( a ); } } } } catch ( NoSuchMethodException nsme ) { } catch ( IllegalAccessException iae ) { } catch ( InvocationTargetException ite ) { } return annotationList; } ConstraintHelper(); List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> getBuiltInConstraints(Class<? extends Annotation> annotationClass); boolean isBuiltinConstraint(Class<? extends Annotation> annotationType); boolean isMultiValueConstraint(Annotation annotation); List<Annotation> getMultiValueConstraints(A annotation); boolean isConstraintAnnotation(Annotation annotation); List<Class<? extends ConstraintValidator<T, ?>>> getConstraintValidatorDefinition(Class<T> annotationClass); void addConstraintValidatorDefinition(Class<A> annotationClass, List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> definitionClasses); boolean containsConstraintValidatorDefinition(Class<? extends Annotation> annotationClass);  }### Answer:
@Test public void testGetMultiValueConstraints() throws Exception { Engine engine = new Engine(); Field[] fields = engine.getClass().getDeclaredFields(); assertNotNull( fields ); assertTrue( fields.length == 1 ); ReflectionHelper.setAccessibility( fields[0] ); Annotation annotation = fields[0].getAnnotation( Pattern.List.class ); assertNotNull( annotation ); List<Annotation> multiValueConstraintAnnotations = constraintHelper.getMultiValueConstraints( annotation ); assertTrue( multiValueConstraintAnnotations.size() == 2, "There should be two constraint annotations" ); assertTrue( multiValueConstraintAnnotations.get( 0 ) instanceof Pattern, "Wrong constraint annotation" ); assertTrue( multiValueConstraintAnnotations.get( 1 ) instanceof Pattern, "Wrong constraint annotation" ); Order order = new Order(); fields = order.getClass().getDeclaredFields(); assertNotNull( fields ); assertTrue( fields.length == 1 ); ReflectionHelper.setAccessibility( fields[0] ); annotation = fields[0].getAnnotation( NotNull.class ); assertNotNull( annotation ); multiValueConstraintAnnotations = constraintHelper.getMultiValueConstraints( annotation ); assertTrue( multiValueConstraintAnnotations.size() == 0, "There should be no constraint annotations" ); }