JSR-349: Bean Validation TCK Coverage

1.1.0

Contents

Chapter Summary
Section Summary
Coverage Detail
Unmatched Tests
Unversioned Tests
Test Group Summary

Coverage Distribution

 
 
 
 
 
 
 
 
 
 

Chapter Summary

Chapter Assertions Testable Total Tested Total Tests Tested
(problematic)
Tested
(working)
Coverage %
1 Introduction000000
2 What's new in 1.1000000
3 Constraint Definition6354457104583.33%
4 Constraint declaration and validation process98888620208697.73%
5 Validation APIs1241089931609991.67%
6 Constraint metadata request APIs43433913103990.70%
7 Built-in Constraint definitions1515150015100.00%
8 XML deployment descriptor7979457404556.96%
9 Exception model5441204100.00%
10 Integration101000000.00%
Total437401333806033383.04%

Section Summary

SectionAssertionsTestableTotal TestedTested
(problematic)
Tested
(working)
Coverage %
1 Introduction00000
2 What's new in 1.100000
3 Constraint Definition00000
3.1 Constraint annotation7320266.67%
3.1.1 Constraint definition properties22202100.00%
3.1.1.1 message11101100.00%
3.1.1.2 groups44404100.00%
3.1.1.3 payload33303100.00%
3.1.1.4 validationAppliesTo550000.00%
3.2 Applying multiple constraints of the same type11101100.00%
3.3 Constraint composition19191601684.21%
3.4 Constraint validation implementation181313013100.00%
3.5 The ConstraintValidatorFactory33303100.00%
4 Constraint declaration and validation process00000
4.1 Requirements on classes to be validated5430375.00%
4.1.1 Object validation11101100.00%
4.1.2 Field and property validation55505100.00%
4.1.3 Graph validation111111011100.00%
4.3 Inheritance (interface and superclass)22202100.00%
4.4 Group and group sequence44404100.00%
4.4.1 Group inheritance22202100.00%
4.4.2 Group sequence107707100.00%
4.4.3 Redefining the Default group for a class43303100.00%
4.4.4 Implicit grouping11101100.00%
4.4.5 Group conversion99909100.00%
4.4.6 Formal group definitions22202100.00%
4.5 Method and constructor constraints00000
4.5.1 Requirements on methods to be validated11101100.00%
4.5.2 Declare parameter constraints11101100.00%
4.5.2.1 Cross-parameter constraints22202100.00%
4.5.2.2 Naming parameters22202100.00%
4.5.3 Declaring return value constraints11101100.00%
4.5.4 Marking parameters and return values for cascaded validation33303100.00%
4.5.5 Method constraints in inheritance hierarchies55505100.00%
4.6 Validation routine31101100.00%
4.6.1 Object graph validation55505100.00%
4.6.2 Method and constructor validation44404100.00%
4.6.3 Traversable property9650583.33%
4.6.4 ConstraintValidator resolution algorithm66606100.00%
5 Validation APIs00000
5.1 Validator API10000
5.1.1 Validation methods111111011100.00%
5.1.2 Methods for validating method and constructor constraints13131201292.31%
5.1.3 groups32202100.00%
5.2 ConstraintViolation242323023100.00%
5.3 Message interpolation00000
5.3.1 Default message interpolation9980888.89%
5.3.1.1 Default message interpolation algorithm7540480.00%
5.3.1.2 Locale for default message interpolation22202100.00%
5.3.1.3 Message expressions using Expression Language (EL)550000.00%
5.3.2 Custom message interpolation21101100.00%
5.5 Bootstrapping11101100.00%
5.5.1 Examples10000
5.5.2 ValidatorFactory33303100.00%
5.5.3 Configuration86606100.00%
5.5.4 ValidationProvider and ValidationProviderResolver00000
5.5.4.1 ValidationProviderResolver32202100.00%
5.5.4.2 ValidationProvider55505100.00%
5.5.5 Validation66606100.00%
5.5.6 XML Configuration: META-INF/validation.xml18141301392.86%
5.5.7 Bootstrapping considerations20000
6 Constraint metadata request APIs00000
6.1 Validator33303100.00%
6.2 ElementDescriptor88808100.00%
6.3 BeanDescriptor77707100.00%
6.4 CascadableDescriptor2210150.00%
6.5 GroupConversionDescriptor220000.00%
6.6 PropertyDescriptor11101100.00%
6.7 ExecutableDescriptor, MethodDescriptor and ConstructorDescriptor7760685.71%
6.8 ParameterDescriptor22202100.00%
6.10 ConstraintDescriptor111111011100.00%
7 Built-in Constraint definitions151515015100.00%
8 XML deployment descriptor11101100.00%
8.1 Constraint definition and declaration55505100.00%
8.1.1 Constraint declaration in XML66606100.00%
8.1.1.1 Class-level overriding55505100.00%
8.1.1.2 Field-level overriding7760685.71%
8.1.1.3 Property-level overriding7760685.71%
8.1.1.4 Constructor-level overriding13130000.00%
8.1.1.5 Method-level overriding14140000.00%
8.1.1.6 Constraint declaration88808100.00%
8.1.1.7 Declaration of group conversions220000.00%
8.1.2 Overriding constraint definitions in XML55505100.00%
8.1.4 XML Schema3320266.67%
8.2 Configuration schema3310133.33%
9 Exception model11101100.00%
9.2 Constraint definition: ConstraintDefinitionException11101100.00%
9.3 Constraint declaration: ConstraintDeclarationException and UnexpectedTypeException21101100.00%
9.4 Group definition: GroupDefinitionException11101100.00%
10 Integration00000
10.1 General requirements00000
10.1.2 Method and constructor validation990000.00%
10.3 Context and Dependency Injection (CDI) integration00000
10.3.2 ConstraintValidatorFactory, MessageInterpolator, ParameterNameProvider and TraversableResolver110000.00%

Coverage Detail

Colour Key
Assertion is covered
Assertion is not covered
Assertion test is unimplemented
Assertion is untestable

Section 3.1 - Constraint annotation

a)

An annotation is considered a generic constraint definition if its retention policy contains RUNTIME and if the annotation itself is annotated with javax.validation.Constraint

b)

An annotation is considered a cross-parameter constraint definition (see section 4.5.2.1) if its retention policy contains RUNTIME and if the annotation itself is annotated with javax.validation.CrossParameterConstraint.

c)

Generic constraint annotations can target any of the following ElementTypes: FIELD for constrained attributes METHOD for constrained getters and constrained method return values CONSTRUCTOR for constrained constructor return values PARAMETER for constrained method and constructor parameters TYPE for constrained beans ANNOTATION_TYPE for constraints composing other constraints

d)

Cross-parameter constraint annotations can target any of the following ElementTypes: METHOD CONSTRUCTOR ANNOTATION_TYPE for cross-parameter constraints composing other cross-parameter constraints

e)

A constraint annotation that is both can target the union of the generic and cross-parameter constraint annotations targets.

Coverage

No tests exist for this assertion

f)

Applying a constraint annotation to an incompatible type will raise an UnexpectedTypeException.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.validatorresolution
ValidatorResolutionTest.testUnexpectedTypeInValidatorResolution()
g)

If a constraint definition is not valid, a ConstraintDefinitionException is raised either at validation time or when the metadata is requested.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithParameterStartingWithValid()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithoutMessageParameter()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithoutGroupParameter()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithoutPayloadParameter()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongDefaultGroupValue()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongDefaultPayloadValue()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongPayloadClass()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongMessageType()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongGroupType()

Section 3.1.1 - Constraint definition properties

a)

A constraint definition may have attributes that are specified at the time the constraint is applied to a JavaBean.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintdefinition
ConstraintDefinitionsTest.testConstraintWithCustomAttributes()
b)

Annotation elements starting with valid are not allowed

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithParameterStartingWithValid()

Section 3.1.1.1 - message

a)

Every constraint annotation must define a message element of type String.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithoutMessageParameter()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongMessageType()

Section 3.1.1.2 - groups

a)

Every constraint annotation must define a groups element that specifies the processing groups with which the constraint declaration is associated.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithoutGroupParameter()
b)

The type of the groups parameter is Class<?>[].

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongGroupType()
c)

The default value must be an empty array.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongDefaultGroupValue()
d)

If no group is specified when declaring the constraint on an element, the Default group is considered declared.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintdefinition
ConstraintDefinitionsTest.testDefaultGroupAssumedWhenNoGroupsSpecified()

Section 3.1.1.3 - payload

a)

Constraint annotations must define a payload element that specifies the payload with which the the constraint declaration is associated.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithoutPayloadParameter()
b)

The default value must be an empty array.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongDefaultPayloadValue()
c)

Each attachable payload extends Payload.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongPayloadClass()

Section 3.1.1.4 - validationAppliesTo

a)

If a ConstraintTarget is used in an illegal situation, a ConstraintDeclarationException is raised either at validation time or when the metadata is requested.

Coverage

No tests exist for this assertion

b)

Using IMPLICIT in a situation that cannot be inferred (see the JavaDoc for the detailed rules),

Coverage

No tests exist for this assertion

c)

Using PARAMETERS on a constructor or method that has no parameter,

Coverage

No tests exist for this assertion

d)

Using RETURN_VALUE on a method with no return value,

Coverage

No tests exist for this assertion

e)

Using PARAMETERS or RETURN_VALUE on a type - class or interface - or on a field.

Coverage

No tests exist for this assertion

Section 3.2 - Applying multiple constraints of the same type

a)

The bean validation provider treats regular annotations (annotations not annotated by @Constraint) whose value element has a return type of an array of constraint annotations in a special way. Each element in the value array are processed by the Bean Validation implementation as regular constraint annotations.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintdefinition
ConstraintDefinitionsTest.testConstraintWithCustomAttributes()

Section 3.3 - Constraint composition

a)Needs update

More formally, each constraint annotation hosted on a constraint annotation is applied to the target element and this is done recursively.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testComposedConstraints()
ConstraintCompositionTest.testComposedConstraintsAreRecursive()
b)

Note that the main annotation and its constraint validation implementation is also applied.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testValidationOfMainAnnotationIsAlsoApplied()
c)

By default, each failing constraint generates an error report.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testEachFailingConstraintCreatesConstraintViolation()
d)

Groups from the main constraint annotation are inherited by the composing annotations.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testGroupsDefinedOnMainAnnotationAreInherited()
e)

Any groups definition on a composing annotation is ignored.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testGroupsDefinedOnMainAnnotationAreInherited()
f)

Payload from the main constraint annotation is inherited by the composing annotations.

Coverage

No tests exist for this assertion

g)

Any payload definition on a composing annotation is ignored.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testPayloadPropagationInComposedConstraints()
h)

The constraint target from the main constraint annotation is inherited by the composing annotations.

Coverage

No tests exist for this assertion

i)

Any validationAppliesTo definition on a composing annotation is ignored.

Coverage

No tests exist for this assertion

j)

The property type upon which composed constraint is placed must be compatible with all constraints (composing and composed).

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testAllComposingConstraintsMustBeApplicableToAnnotatedType()
k)

More specifically, if a composed constraint is marked as @ReportAsSingleViolation, the evaluation of the composing constraints stops at the first failing constraint and the error report corresponding to the composed constraint is generated and returned.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testOnlySingleConstraintViolation()
org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition.nestedconstraintcomposition
NestedConstraintCompositionTest.testCompositeConstraint1WithNestedConstraintSingleViolation()
NestedConstraintCompositionTest.testCompositeConstraint2WithNestedConstraintSingleViolation()
NestedConstraintCompositionTest.testCompositeConstraint3WithNestedConstraint()
NestedConstraintCompositionTest.testCompositeConstraint4WithNestedConstraintSingleViolation()
l)

Composing annotations can define the value of message and custom attributes (excluding groups and payload) but these are fixed in the composed constraint definition.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testAttributesDefinedOnComposingConstraints()
m)

It is possible to override attributes and messages defined on a composing annotation. An attribute from the main annotation is used to override one or more attributes of the composing annotations. Such an attribute is annotated with the @OverridesAttribute annotation or its multivalued equivalent @OverridesAttribute.List.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testEachFailingConstraintCreatesConstraintViolation()
n)

The types of the overridden and overriding attributes must be identical.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testOverriddenAttributesMustMatchInType()
o)

A composing constraint can itself be a composed constraint. In this case, attribute values are overridden recursively according to the described rules.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testComposedConstraints()
ConstraintCompositionTest.testComposedConstraintsAreRecursive()
p)

If a constraint is used more than once as a composing constraint, the multi value constraints model as described in 3.2 is used.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testEachFailingConstraintCreatesConstraintViolation()
q)

To select a specific composing constraint, OverridesAttribute.constraintIndex is used. It represents the constraint index in the value array.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testEachFailingConstraintCreatesConstraintViolation()
r)

If index is undefined, the single constraint declaration is targeted.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testEachFailingConstraintCreatesConstraintViolation()
s)Needs update

If the composition is invalid, e.g. infinitely recursive composition wrong attribute overriding a single attribute mapped to more than one source attribute A composing and composed constraint marked as different constraint types (i.e., generic with @Constraint and cross-parameter with @CrossParameterConstraint) etc. a ConstraintDefinitionException is raised either at validation time or when the metadata is requested.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testOverriddenAttributesMustMatchInType()

Section 3.4 - Constraint validation implementation

a)

A constraint validation implementation performs the validation of a given constraint annotation for a given type.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.customconstraint
CustomConstraintValidatorTest.testRightValidatorIsSelectedAndInitializedCalled()
CustomConstraintValidatorTest.testIsValidIsCalledForEachValidation()
b)Needs update

The implementation classes are specified by the validatedBy element of the @Constraint respectively @CrossParameterConstraint annotation that decorates the constraint definition.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.customconstraint
CustomConstraintValidatorTest.testRightValidatorIsSelectedAndInitializedCalled()
CustomConstraintValidatorTest.testIsValidIsCalledForEachValidation()
c)

The constraint validation implementation implements the ConstraintValidator interface.

d)

Some restrictions apply on the generic type T (used in the isValid method). T must resolve to a non parameterized type (i.e. because the type is not using generics or because the raw type is used instead of the generic version) or generic parameters of T must be unbounded wildcard types (i.e. <?>).

e)

If A is a cross-parameter constraint annotation type, T must resolve to Object[] in order to have the array of parameter values passed to the isValid() method.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testValidatorForCrossParameterConstraintMustValidateObjectArray()
f)

The initialize method is called by the Bean validation provider prior to any use of the constraint implementation.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.customconstraint
CustomConstraintValidatorTest.testRightValidatorIsSelectedAndInitializedCalled()
g)

The isValid method is evaluated by the Bean Validation provider each time a given value is validated.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.customconstraint
CustomConstraintValidatorTest.testIsValidIsCalledForEachValidation()
h)

It returns false if the value is not valid, true otherwise.

i)

isValid implementations must be thread-safe.

j)

If the property is of an unanticipated type, an UnexpectedTypeException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.validatorresolution
ValidatorResolutionTest.testUnexpectedTypeInValidatorResolution()
org.hibernate.beanvalidation.tck.tests.constraints.customconstraint
CustomConstraintValidatorTest.testUnexpectedTypeExceptionIsRaisedForInvalidType()
k)

If an exception occurs either in the initialize or isValid method, the runtime exception is wrapped into a ValidationException by the Bean Validation engine.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.customconstraint
CustomConstraintValidatorTest.testRuntimeExceptionFromIsValidIsWrapped()
CustomConstraintValidatorTest.testRuntimeExceptionFromInitializeIsWrapped()
l)

The constraint validation implementation is not allowed to change the state of the value passed to isValid.

m)

By default, each invalid constraint leads to the generation of one error object represented by a ConstraintViolation object. This object is built from the default constraint message template as defined by the constraint declaration and the context in which the constraint declaration is placed (bean, property, attribute, method or constructor parameter, method or constructor return value).

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.customconstraint
CustomConstraintValidatorTest.testOneConstraintViolationPerFailingConstraint()
org.hibernate.beanvalidation.tck.tests.validation.validatorcontext
ConstraintValidatorContextTest.testDefaultError()
n)

The ConstraintValidatorContext methods let the constraint implementation disable the default ConstraintViolation generation and create one or more custom ones.

Coverage

org.hibernate.beanvalidation.tck.tests.validation.validatorcontext
ConstraintValidatorContextTest.testDisableDefaultErrorWithCustomErrorNoSubNode()
ConstraintValidatorContextTest.testDisableDefaultErrorWithCustomErrorWithSubNode()
ConstraintValidatorContextTest.propertyPathInIterable()
o)

The non-interpolated message passed as a parameter is used to build the ConstraintViolation message (the message interpolation operation is applied to it).

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.customconstraint
CustomConstraintValidatorTest.testNonInterpolatedMessageParameterIsUsed()
p)Needs update

By default, the Path exposed on the ConstraintViolation represents the path to the bean, property, parameter or return value hosting the constraint (see 5.2 for more information).

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testGraphValidationWithList()
ValidateTest.testGraphValidationWithArray()
org.hibernate.beanvalidation.tck.tests.constraints.customconstraint
CustomConstraintValidatorTest.testDefaultPropertyPath()
q)

You can point it to a subpath of this default path by using the constraint violation builder fluent API.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.constraintcomposition
ConstraintCompositionTest.testValidationOfMainAnnotationIsAlsoApplied()
org.hibernate.beanvalidation.tck.tests.validation.validatorcontext
ConstraintValidatorContextTest.testDisableDefaultErrorWithCustomErrorWithSubNode()
ConstraintValidatorContextTest.propertyPathInIterable()
r)

If disableDefaultConstraintViolation is called, no custom error is added (using the error builder) and if the constraint is not valid, a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.validation.validatorcontext
ConstraintValidatorContextTest.testDisableDefaultErrorWithoutAddingCustomError()

Section 3.5 - The ConstraintValidatorFactory

a)

The default ConstraintValidatorFactory provided by the Bean Validation provider implementation uses the public no-arg constructor of the ConstraintValidator class.

Coverage

org.hibernate.beanvalidation.tck.tests.validatorfactory
CustomConstraintValidatorTest.testDefaultConstructorInValidatorCalled()
b)

If an exception occurs in the factory while retrieving the ConstraintValidator instance, the runtime exception is wrapped in a ValidationException.

Coverage

org.hibernate.beanvalidation.tck.tests.validatorfactory
CustomConstraintValidatorTest.testRuntimeExceptionInValidatorCreationIsWrapped()
c)

If the instance returned by the factory is null, a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.validatorfactory
CustomConstraintValidatorTest.testValidationExceptionIsThrownInCaseFactoryReturnsNull()

Section 4.1 - Requirements on classes to be validated

a)

Properties to be validated must follow the method signature conventions for JavaBeans read properties, as defined by the JavaBeans specification. These properties are commonly referred as getters.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testUnexpectedTypeException()
ValidateTest.testConstraintViolation()
b)

Static fields and static methods are excluded from validation.

c)

Constraints can be applied to interfaces and superclasses.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application
ValidationRequirementTest.testClassLevelConstraints()
d)

What is a getter? The JavaBeans specification specifies that a getter is a method whose name starts with get and has a return type but no parameter name starts with is, has no parameter and is returning Boolean

Coverage

No tests exist for this assertion

e)

The target of an annotation definition can be a field, property, or type, provided that: the constraint definition supports the specified target (java.lang.annotation.Target) one of the ConstraintValidators declared on the constraint supports the declared type of the target (see 4.6.4).

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application
ValidationRequirementTest.testClassLevelConstraints()
ValidationRequirementTest.testFieldAccess()
ValidationRequirementTest.testPropertyAccess()

Section 4.1.1 - Object validation

a)

Constraint declarations can be applied to a class or an interface.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application
ValidationRequirementTest.testClassLevelConstraints()

Section 4.1.2 - Field and property validation

a)

Constraint declarations can be applied on both fields and properties for the same object type.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application
ValidationRequirementTest.testFieldAccess()
ValidationRequirementTest.testPropertyAccess()
ValidationRequirementTest.testConstraintAppliedOnFieldAndProperty()
b)

The same constraint should however not be duplicated between a field and its associated property (the constraint validation would be applied twice).

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application
ValidationRequirementTest.testConstraintAppliedOnFieldAndProperty()
c)

When a field is annotated with a constraint declaration, field access strategy is used to access the state validated by such constraint.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application
ValidationRequirementTest.testFieldAccess()
d)

When a property is annotated with a constraint declaration, property access strategy is used to access the state validated by such constraint.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application
ValidationRequirementTest.testPropertyAccess()
e)

The fields or methods visibility are not constrained.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application
ValidationRequirementTest.testFieldAndPropertyVisibilityIsNotConstrained()

Section 4.1.3 - Graph validation

a)

Consider the situation where bean X contains a field of type Y. By annotating field Y with the @Valid annotation, the Validator will validate Y (and its properties) when X is validated.

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testGraphNavigationDeterminism()
b)

The exact type Z of the value contained in the field declared of type Y (subclass, implementation) is determined at runtime. The constraint definitions of Z are used.

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testTypeOfContainedValueIsDeterminedAtRuntime()
c)

Any object implementing java.lang.Iterable is supported.

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testContainedIterable()
d)

Arrays of objects

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testGraphValidationWithArray()
e)

java.util.Collection

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testTypeOfContainedValuesIsDeterminedAtRuntime()
f)

java.util.Set

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testContainedSet()
g)

java.util.List

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testNoEndlessLoop()
h)

java.util.Map

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testContainedMap()
i)

For Map, the value of each Map.Entry is validated (the key is not validated).

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testContainedMap()
j)

Like regular references, its type is determined at runtime and the constraint definitions for this particular type are used.

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testTypeOfContainedValuesIsDeterminedAtRuntime()
k)

The @Valid annotation is applied recursively.

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testGraphNavigationDeterminism()

Section 4.3 - Inheritance (interface and superclass)

a)

A constraint declaration can be placed on an interface.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.inheritance
ConstraintInheritanceTest.testConstraintsOnInterfaceAreInherited()
b)

For a given class, constraint declarations held on superclasses as well as interfaces are evaluated by the Bean Validation provider.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.inheritance
ConstraintInheritanceTest.testConstraintsOnInterfaceAreInherited()
ConstraintInheritanceTest.testConstraintsOnSuperClassAreInherited()

Section 4.4 - Group and group sequence

a)

If no group is explicitly declared, a constraint belongs to the Default group.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups
GroupTest.testConstraintWithNoExplicitlySpecifiedGroupBelongsToDefault()
b)

Groups are represented by interfaces.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups
GroupTest.testValidateAgainstDifferentGroups()
c)

A constraint can belong to one or more groups.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups
GroupTest.testValidationFailureInMultipleGroups()
GroupTest.testConstraintCanBelongToMoreThanOneGroup()
d)

During the validation call, one or more groups are validated. All the constraints belonging to this set of group is evaluated on the object graph.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups
GroupTest.testValidateAgainstDifferentGroups()
GroupTest.testGroups()
GroupTest.testGroupSequenceFollowedByGroup()

Section 4.4.1 - Group inheritance

a)

A group may inherit one or more groups by using interface inheritance.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.inheritance
GroupInheritanceTest.testGroupCanInheritGroupsViaInterfaceInheritance()
b)

For a given interface Z, constraints marked as belonging to the group Z (i.e. where the annotation element groups contains the interface Z) or any of the super interfaces of Z (inherited groups) are considered part of the group Z.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.inheritance
GroupInheritanceTest.testGroupMembership()

Section 4.4.2 - Group sequence

a)

By default, constraints are evaluated in no particular order regardless of which groups they belong to.

b)

Each group in a group sequence must be processed sequentially in the order defined by @GroupSequence.value when the group defined as a sequence is requested.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups
GroupTest.testGroupSequence()
org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testFullGraphValidationBeforeNextGroupInSequence()
c)

Note that a group member of a sequence can itself be composed of several groups via inheritance or sequence definition. In this case, each composed group must respect the sequence order as well.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupsequence
SequenceResolutionTest.testGroupSequenceContainerOtherGroupSequences()
d)

If one of the groups processed in the sequence generates one or more constraint violations, the groups following in the sequence must not be processed.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups
GroupTest.testGroupSequence()
org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testFullGraphValidationBeforeNextGroupInSequence()
e)

Groups defining a sequence and groups composing a sequence must not be involved in a cyclic dependency: either directly or indirectly either through cascaded sequence definitions or group inheritance

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupsequence
SequenceResolutionTest.testInvalidDefinitionOfDefaultSequenceInEntity()
org.hibernate.beanvalidation.tck.tests.constraints.groups
GroupTest.testCyclicGroupSequence()
f)

If a group containing such a circularity is evaluated, a GroupDefinitionException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupsequence
SequenceResolutionTest.testInvalidDefinitionOfDefaultSequenceInEntity()
org.hibernate.beanvalidation.tck.tests.constraints.groups
GroupTest.testCyclicGroupSequence()
g)

Groups defining a sequence should not directly inherit other groups. In other words, the interface hosting the group sequence should not have any super interface.

h)

Groups defining a sequence should not be used directly in constraint declarations.

i)

To define a group as a sequence, the interface must be annotated with the @GroupSequence annotation.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupsequence
SequenceResolutionTest.testInvalidDefinitionOfDefaultSequenceInEntity()
org.hibernate.beanvalidation.tck.tests.constraints.groups
GroupTest.testCyclicGroupSequence()
j)

A given constraint can belong to two or more groups ordered by a sequence. In this case, the constraint is evaluated as part of the first group and ignored in the subsequent group(s).

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupsequence
SequenceResolutionTest.testOnlyFirstGroupInSequenceGetEvaluated()

Section 4.4.3 - Redefining the Default group for a class

a)

To redefine Default for a class, place a @GroupSequence annotation on the class; this sequence expresses the sequence of groups that does substitute Default for this class.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupsequenceisolation
GroupSequenceIsolationTest.testCorrectDefaultSequenceInheritance()
GroupSequenceIsolationTest.testCorrectDefaultSequenceInheritance2()
org.hibernate.beanvalidation.tck.tests.constraints.groups
DefaultGroupRedefinitionTest.testRedefiningDefaultGroup()
DefaultGroupRedefinitionTest.testValidatingAgainstRedefinedDefaultGroup()
b)

Constraints hosted on a class A and belonging to the Default group (by default or explicitly) implicitly belong to the group A.

c)

A sequence defined on a class A (i.e. redefining the Default groups for the class) must contain the group A.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupsequenceisolation
GroupSequenceIsolationTest.testCorrectDefaultSequenceInheritance()
GroupSequenceIsolationTest.testCorrectDefaultSequenceInheritance2()
org.hibernate.beanvalidation.tck.tests.constraints.groups
DefaultGroupRedefinitionTest.testGroupSequenceContainingDefault()
DefaultGroupRedefinitionTest.testGroupSequenceWithNoImplicitDefaultGroup()
d)

If a @GroupSequence redefining the Default group for a class A does not contain the group A, a GroupDefinitionException is raised when the class is validated or when its metadata is requested.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups
DefaultGroupRedefinitionTest.testGroupSequenceContainingDefault()
DefaultGroupRedefinitionTest.testGroupSequenceWithNoImplicitDefaultGroup()

Section 4.4.4 - Implicit grouping

a)

Every constraint hosted on an interface Z and part of the Default group (implicitly or explicitly) belongs to the group Z.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups
GroupTest.testImplicitGrouping()

Section 4.4.5 - Group conversion

a)

@ConvertGroup and @ConvertGroup.List can be used everywhere @Valid can be used (associations, method/constructor parameters and return value). If these annotations are used without @Valid, a ConstraintDeclarationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupconversion
InvalidGroupDefinitionsTest.testGroupConversionWithoutValidAnnotationOnField()
InvalidGroupDefinitionsTest.testGroupConversionWithoutValidAnnotationOnProperty()
InvalidGroupDefinitionsTest.testGroupConversionWithoutValidAnnotationOnMethodReturnValue()
InvalidGroupDefinitionsTest.testGroupConversionWithoutValidAnnotationOnMethodParameter()
InvalidGroupDefinitionsTest.testGroupConversionWithoutValidAnnotationOnConstructorReturnValue()
InvalidGroupDefinitionsTest.testGroupConversionWithoutValidAnnotationOnConstructorParameter()
b)

If the group expected to be passed to the nested element validation is defined as the from attribute of a @ConvertGroup annotation, the group used to effectively validate the nested element is the corresponding group defined in the to attribute.

Coverage

org.hibernate.beanvalidation.tck.tests.validation.groupconversion
GroupConversionValidationTest.testGroupConversionIsAppliedOnField()
GroupConversionValidationTest.testSeveralGroupConversionsAppliedOnField()
GroupConversionValidationTest.testGroupConversionIsAppliedOnProperty()
GroupConversionValidationTest.testGroupConversionIsAppliedOnMethodReturnValue()
GroupConversionValidationTest.testGroupConversionDefinedInSubClassIsAppliedOnMethodReturnValue()
GroupConversionValidationTest.testGroupConversionDefinedInImplementedClassIsAppliedOnMethodReturnValue()
GroupConversionValidationTest.testGroupConversionIsAppliedOnMethodParameter()
GroupConversionValidationTest.testGroupConversionIsAppliedOnConstructorReturnValue()
GroupConversionValidationTest.testGroupConversionIsAppliedOnConstructorParameter()
c)

Rules are not executed recursively.

Coverage

org.hibernate.beanvalidation.tck.tests.validation.groupconversion
GroupConversionValidationTest.testGroupConversionIsNotExecutedRecursively()
d)

It is not legal to have more than one conversion rule containing the same from value. In this case, a ConstraintDeclarationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupconversion
InvalidGroupDefinitionsTest.testSeveralGroupConversionsWithSameFrom()
e)

Like regular constraint declarations, the from attribute cannot refer to a group sequence. A ConstraintDeclarationException is raised in this situation.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupconversion
InvalidGroupDefinitionsTest.testGroupConversionWithSequenceAsFrom()
f)

The to attribute can. The group sequence will then be expanded before validating the associated object.

Coverage

org.hibernate.beanvalidation.tck.tests.validation.groupconversion
GroupConversionValidationTest.testGroupConversionWithSequenceAsTo()
g)

@ConvertGroup and @ConvertGroup.List can only be placed where @Valid is present to ensure proper respect of the Liskov substitution principle

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupconversion
InvalidGroupDefinitionsTest.testGroupConversionGivenOnParameterInSubClass()
InvalidGroupDefinitionsTest.testGroupConversionGivenOnParameterInImplementingClass()
h)

Likewise, if a sub type overrides/implements a method originally defined in several parallel types of the hierarchy (e.g. two interfaces not extending each other, or a class and an interface not implemented by said class) and if that method's return value has been marked for cascading validation in one of the parallel types, no group conversion rule may be declared for that method's return value in the parallel types of the hierarchy.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupconversion
InvalidGroupDefinitionsTest.testGroupConversionGivenOnParameterInParallelInterfaces()
InvalidGroupDefinitionsTest.testGroupConversionGivenOnReturnValueInParallelInterfaces()
InvalidGroupDefinitionsTest.testGroupConversionGivenOnParameterInSuperClassAndImplementedInterface()
InvalidGroupDefinitionsTest.testGroupConversionGivenOnReturnValueInSuperClassAndImplementedInterface()
i)

If any of these rules is violated, a ConstraintDeclarationException is raised by default as defined in 4.5.5.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupconversion
InvalidGroupDefinitionsTest.testGroupConversionGivenOnParameterInSubClass()
InvalidGroupDefinitionsTest.testGroupConversionGivenOnParameterInImplementingClass()
InvalidGroupDefinitionsTest.testGroupConversionGivenOnParameterInParallelInterfaces()
InvalidGroupDefinitionsTest.testGroupConversionGivenOnReturnValueInParallelInterfaces()
InvalidGroupDefinitionsTest.testGroupConversionGivenOnParameterInSuperClassAndImplementedInterface()
InvalidGroupDefinitionsTest.testGroupConversionGivenOnReturnValueInSuperClassAndImplementedInterface()

Section 4.4.6 - Formal group definitions

a)

If X has no @GroupSequence annotation, the group Default contains the following constraints: every constraint in the group X if X has a direct superclass Y, every constraint in the group Default of Y

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupsequenceisolation
GroupSequenceIsolationTest.testCorrectDefaultSequenceInheritance3()
b)

If X does have a @GroupSequence annotation, the group Default contains every constraint belonging to every group declared by the @GroupSequence annotation.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupsequenceisolation
GroupSequenceIsolationTest.testCorrectDefaultSequenceInheritance()
GroupSequenceIsolationTest.testCorrectDefaultSequenceInheritance2()

Section 4.5.1 - Requirements on methods to be validated

a)

Constrained methods must be non-static.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application.method
MethodValidationRequirementTest.testValidatedMethodsMustNotBeStatic()

Section 4.5.2 - Declare parameter constraints

a)

Parameter constraints are declared by putting constraint annotations on method or constructor parameters.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application.method
MethodValidationRequirementTest.testMethodParameterConstraintsAreDeclaredByAnnotingParameters()
MethodValidationRequirementTest.testConstructorParameterConstraintsAreDeclaredByAnnotingParameters()

Section 4.5.2.1 - Cross-parameter constraints

a)

Cross-parameter constraints are declared by putting cross-parameter constraint annotations on methods or constructors

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application.method
MethodValidationRequirementTest.testCrossParameterConstraintsAreDeclaredByAnnotatingMethods()
MethodValidationRequirementTest.testCrossParameterConstraintsAreDeclaredByAnnotatingConstructors()
b)

Cross parameters constraints are validated at the same time as parameter constraints.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application.method
MethodValidationRequirementTest.testMethodParameterAndCrossParameterConstraintsAreEvaluatedAtTheSameTime()
MethodValidationRequirementTest.testConstructorParameterAndCrossParameterConstraintsAreEvaluatedAtTheSameTime()

Section 4.5.2.2 - Naming parameters

a)

A conforming Bean Validation implementation provides a default ParameterNameProvider implementation which returns parameter names in the form argPARAMETERINDEX, where PARAMETERINDEX starts at 0 for the first parameter, e.g. arg0, arg1 etc.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation.parameternameprovider
DefaultParameterNameProviderTest.testDefaultParameterProviderForMethod()
DefaultParameterNameProviderTest.testDefaultParameterProviderForConstructor()
b)

If an exception occurs during invocation of the getParameterNames() methods, this exception is wrapped into a ValidationException by the Bean Validation engine.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation.parameternameprovider
ParameterNameProviderTest.testExceptionInParameterNameProviderIsWrappedIntoValidationException()

Section 4.5.3 - Declaring return value constraints

a)

Return value constraints are declared by putting constraint annotations directly on a method or constructor.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application.method
MethodValidationRequirementTest.testReturnValueConstraintsAreDeclaredByAnnotatingMethods()
MethodValidationRequirementTest.testReturnValueConstraintsAreDeclaredByAnnotatingConstructors()

Section 4.5.4 - Marking parameters and return values for cascaded validation

a)

Similar to normal bean validation, the @Valid annotation is used to declare that a cascaded validation of the given method parameters or return values shall be performed by the Bean Validation provider. When marked, the parameter or return value is considered a bean object to validate.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application.method
MethodValidationRequirementTest.testMethodParameterIsMarkedAsCascaded()
MethodValidationRequirementTest.testConstructorParameterIsMarkedAsCascaded()
MethodValidationRequirementTest.testMethodReturnValueIsMarkedAsCascaded()
MethodValidationRequirementTest.testConstructorReturnValueIsMarkedAsCascaded()
b)

Null arguments and null return values are ignored

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application.method
MethodValidationRequirementTest.testPassingNullToCascadedMethodParameterCausesNoViolation()
MethodValidationRequirementTest.testPassingNullToCascadedConstructorParameterCausesNoViolation()
MethodValidationRequirementTest.testReturningNullFromCascadedMethodCausesNoViolation()
c)

The validation is recursive; that is, if validated parameter or return value objects have references marked with @Valid themselves, these references will also be validated

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.application.method
MethodValidationRequirementTest.testCascadedMethodParameterIsValidatedRecursively()
MethodValidationRequirementTest.testCascadedConstructorParameterIsValidatedRecursively()
MethodValidationRequirementTest.testCascadedMethodReturnValueIsValidatedRecursively()
MethodValidationRequirementTest.testCascadedConstructorReturnValueIsValidatedRecursively()

Section 4.5.5 - Method constraints in inheritance hierarchies

a)

In sub types (be it sub classes/interfaces or interface implementations) no parameter constraints must be declared on overridden or implemented methods, nor may parameters be marked for cascaded validation. This would pose a strengthening of preconditions to be fulfilled by the caller.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.inheritance.method.invaliddeclarations
InvalidMethodConstraintDeclarationTest.testParameterConstraintsAddedInInterfaceImplementationCausesException()
InvalidMethodConstraintDeclarationTest.testParameterConstraintsAddedInSubClassCausesException()
InvalidMethodConstraintDeclarationTest.testParameterMarkedAsCascadedInInterfaceImplementationCausesException()
InvalidMethodConstraintDeclarationTest.testParameterMarkedAsCascadedInSubClassCausesException()
b)

If a sub type overrides/implements a method originally defined in several parallel types of the hierarchy (e.g. two interfaces not extending each other, or a class and an interface not implemented by said class) no parameter constraints may be declared for that method at all nor parameters be marked for cascaded validation. This again is to avoid an unexpected strengthening of preconditions to be fulfilled by the caller.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.inheritance.method.invaliddeclarations
InvalidMethodConstraintDeclarationTest.testConstrainedParameterInOneMethodOfParallelInterfacesCausesException()
InvalidMethodConstraintDeclarationTest.testParameterIsConstrainedInInterfaceMethodAndSuperClassMethodCausesException()
InvalidMethodConstraintDeclarationTest.testParameterIsCascadingInOneMethodOfParallelInterfacesCausesException()
InvalidMethodConstraintDeclarationTest.testParameterIsCascadingInInterfaceMethodAndSuperClassMethodCausesException()
c)

In sub types (be it sub classes/interfaces or interface implementations) return value constraints may be declared on overridden or implemented methods and the return value may be marked for cascaded validation. Upon validation, all return value constraints of the method in question are validated, wherever they are declared in the hierarchy; This only poses possibly a strengthening but no weakening of the method's postconditions guaranteed to the caller.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.inheritance.method.validdeclarations
ValidMethodConstraintDeclarationTest.testReturnValueConstraintAddedInInterfaceImplementation()
ValidMethodConstraintDeclarationTest.testReturnValueConstraintAddedInSubClass()
ValidMethodConstraintDeclarationTest.testReturnValueMarkedAsCascadedInInterfaceImplementation()
ValidMethodConstraintDeclarationTest.testReturnValueConstraintFromInterfaceAndImplementationAddUp()
ValidMethodConstraintDeclarationTest.testReturnValueConstraintFromInterfacesAndImplementationAddUp()
ValidMethodConstraintDeclarationTest.testReturnValueMarkedAsCascadedInSubClass()
d)

One must not mark a method return value for cascaded validation more than once in a line of a class hierarchy. In other words, overriding methods on sub types (be it sub classes/interfaces or interface implementations) cannot mark the return value for cascaded validation if the return value has already been marked on the overridden method of the super type or interface.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.inheritance.method.invaliddeclarations
InvalidMethodConstraintDeclarationTest.testReturnValueIsMarkedAsCascadedInInterfaceAndImplementationCausesException()
InvalidMethodConstraintDeclarationTest.testReturnValueIsMarkedAsCascadedInBaseAndSubClassCausesException()
InvalidMethodConstraintDeclarationTest.testReturnValueIsMarkedAsCascadedInSuperAndDerivedInterfaceCausesException()
e)

The above rules do not apply when validating constructor constraints as constructors do not override one another. Parameter and return value constraints can be applied to any constructor in the type hierarchy, but only the constraints defined directly on the validated constructor are evaluated.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.inheritance.method.validdeclarations
ValidMethodConstraintDeclarationTest.testParameterConstraintAddedToConstructorInSubClass()
ValidMethodConstraintDeclarationTest.testParameterConstraintMarkedAsCascadedAtConstructorInSubClass()
ValidMethodConstraintDeclarationTest.testReturnValueConstraintAddedToConstructorInSubClass()
ValidMethodConstraintDeclarationTest.testReturnValueMarkedAsCascadedAtConstructorInSuperAndSubClass()

Section 4.6 - Validation routine

a)

For a given group, the validation routine applied on a given bean instance is expected to execute the following constraint validations in no particular order

b)

Note that this implies that a given validation constraint will not be processed more than once per validation.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups
GroupTest.testValidationFailureInMultipleGroups()
org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testOnlyFirstGroupInSequenceGetEvaluated()
c)

Unless ordered by group sequences, groups can be validated in no particular order.

Section 4.6.1 - Object graph validation

a)

The @Valid annotation on a given association (i.e. object reference or collection, array, Iterable of objects), dictates the Bean Validator implementation to apply recursively the Bean Validation routine on (each of) the associated object(s).

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testGraphNavigationDeterminism()
b)

This mechanism is recursive: an associated object can itself contain cascaded references.

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testGraphNavigationDeterminism()
c)

Null references are ignored.

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testNullReferencesGetIgnored()
d)

To prevent infinite loops, the Bean Validation implementation must ignore the cascading operation if the associated object instance has already been validated in the current navigation path (starting from the root object).

Coverage

org.hibernate.beanvalidation.tck.tests.validation.graphnavigation
GraphNavigationTest.testNoEndlessLoop()
e)

@Valid is an orthogonal concept to the notion of group. If two groups are in sequence, the first group must pass for all associated objects before the second group is evaluated.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupsequenceisolation
GroupSequenceIsolationTest.testCorrectDefaultSequenceContainedCaseWithoutGroupRedefinitionOnContainedEntity()
GroupSequenceIsolationTest.testCorrectDefaultSequenceContainedCaseWithGroupRedefinitionOnContainedEntity()

Section 4.6.2 - Method and constructor validation

a)

For a given group, the validation routine applied to validate parameters of a method or constructor is expected to execute the following constraint validations in no particular order

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
MethodValidationTest.methodParameterValidationValidatesEachConstraintOnlyOnce()
MethodValidationTest.methodParameterValidationUsingSequence()
MethodValidationTest.methodParameterValidationWithRedefinedDefaultGroupSequence()
MethodValidationTest.constructorParameterValidationValidatesEachConstraintOnlyOnce()
MethodValidationTest.constructorParameterValidationUsingSequence()
MethodValidationTest.constructorParameterValidationWithRedefinedDefaultGroupSequence()
MethodValidationTest.methodParameterValidationTargetsParameterCrossParameterAndCascadedConstraints()
MethodValidationTest.methodParameterValidationIncludesConstraintsFromSuperClass()
MethodValidationTest.methodParameterValidationIncludesConstraintsFromImplementedInterface()
MethodValidationTest.methodParameterValidationIsAppliedGroupWise()
MethodValidationTest.methodParameterValidationPerformsGroupConversion()
MethodValidationTest.constructorParameterValidationTargetsParameterCrossParameterAndCascadedConstraints()
MethodValidationTest.constructorParameterValidationDoesNotIncludeConstraintsFromSuperClass()
MethodValidationTest.constructorParameterValidationIsAppliedGroupWise()
MethodValidationTest.constructorParameterValidationPerformsGroupConversion()
b)

For a given group, the validation routine applied to validate the return value of a method or constructor is expected to execute the following constraint validations in no particular order

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
MethodValidationTest.methodReturnValueValidationValidatesEachConstraintOnlyOnce()
MethodValidationTest.methodReturnValueValidationUsingSequence()
MethodValidationTest.methodReturnValueValidationWithRedefinedDefaultGroupSequence()
MethodValidationTest.constructorReturnValueValidationValidatesEachConstraintOnlyOnce()
MethodValidationTest.constructorReturnValueValidationUsingSequence()
MethodValidationTest.constructorReturnValueValidationWithRedefinedDefaultGroupSequence()
MethodValidationTest.methodReturnValueValidationTargetsReturnValueAndCascadedConstraints()
MethodValidationTest.methodReturnValueValidationIncludesConstraintsFromSuperClass()
MethodValidationTest.methodReturnValueValidationIncludesConstraintsFromImplementedInterface()
MethodValidationTest.methodReturnValueValidationIsAppliedGroupWise()
MethodValidationTest.methodReturnValueValidationPerformsGroupConversion()
MethodValidationTest.constructorReturnValueValidationTargetsReturnValueAndCascadedConstraints()
MethodValidationTest.constructorReturnValueValidationDoesNotIncludeConstraintsFromSuperClass()
MethodValidationTest.constructorReturnValueValidationIsAppliedGroupWise()
MethodValidationTest.constructorReturnValueValidationPerformsGroupConversion()
c)

Note that this implies that a given validation constraint will not be processed more than once per validation.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
MethodValidationTest.methodParameterValidationValidatesEachConstraintOnlyOnce()
MethodValidationTest.constructorParameterValidationValidatesEachConstraintOnlyOnce()
MethodValidationTest.methodReturnValueValidationValidatesEachConstraintOnlyOnce()
MethodValidationTest.constructorReturnValueValidationValidatesEachConstraintOnlyOnce()
d)

Unless ordered by group sequences, groups can be validated in no particular order.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
MethodValidationTest.methodParameterValidationUsingSequence()
MethodValidationTest.methodParameterValidationWithRedefinedDefaultGroupSequence()
MethodValidationTest.constructorParameterValidationUsingSequence()
MethodValidationTest.constructorParameterValidationWithRedefinedDefaultGroupSequence()
MethodValidationTest.methodReturnValueValidationUsingSequence()
MethodValidationTest.methodReturnValueValidationWithRedefinedDefaultGroupSequence()
MethodValidationTest.constructorReturnValueValidationUsingSequence()
MethodValidationTest.constructorReturnValueValidationWithRedefinedDefaultGroupSequence()

Section 4.6.3 - Traversable property

a)

isReachable is called for every property about to be accessed either for validation or for cascading.

Coverage

org.hibernate.beanvalidation.tck.tests.traversableresolver
TraversableResolverTest.testCorrectNumberOfCallsToIsReachableAndIsCascadable()
b)

isCascadable is called for every property about to be cascaded (i.e. marked as @Valid).

Coverage

org.hibernate.beanvalidation.tck.tests.traversableresolver
TraversableResolverTest.testCorrectNumberOfCallsToIsReachableAndIsCascadable()
c)

isCascadable for a given property is only called if isReachable returns true. In other words, isReachable is always called before isCascadable for a given property.

Coverage

org.hibernate.beanvalidation.tck.tests.traversableresolver
TraversableResolverTest.testCorrectNumberOfCallsToIsReachableAndIsCascadable()
d)

The Bean Validation provider must not access the state of a property, nor validate its constraints if the property is not traversable. A property is traversable if TraversableResolver returns true for this property.

Coverage

org.hibernate.beanvalidation.tck.tests.traversableresolver
TraversableResolverTest.testCustomTraversableResolverViaConfiguration()
e)

If an exception occurs when the TraversableResolver is called, the exception is wrapped into a ValidationException.

Coverage

org.hibernate.beanvalidation.tck.tests.traversableresolver
TraversableResolverTest.testResolverExceptionsGetWrappedInValidationException()
f)

If Java Persistence is available in the runtime environment, a property is considered reachable if Java Persistence considers the property as loaded.

g)

If Java Persistence is not available in the runtime environment, all properties are considered reachable.

h)

All properties are considered cascadable.

i)

The following elements are not passed through the traversable resolver filter: the bean instance validated the parameter values being validated the return value being validated But the properties of these elements (if validated) are.

Coverage

No tests exist for this assertion

Section 4.6.4 - ConstraintValidator resolution algorithm

a)

If the constraint declaration is hosted on a class or an interface, the targeted type is the class or the interface.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.validatorresolution
ValidatorResolutionTest.testTargetTypeIsInterface()
ValidatorResolutionTest.testTargetTypeIsClass()
b)

If the constraint is hosted on a class attribute, the type of the attribute is the targeted type.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.validatorresolution
ValidatorResolutionTest.testTargetedTypeIsField()
c)

If the constraint is hosted on a getter, the return type of the getter is the targeted type.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.validatorresolution
ValidatorResolutionTest.testTargetedTypeIsGetter()
d)

The ConstraintValidator chosen to validate a declared type T is the one where the type supported by the ConstraintValidator is a supertype of T and where there is no other ConstraintValidator whose supported type is a supertype of T and not a supertype of the chosen ConstraintValidator supported type.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.validatorresolution
ValidatorResolutionTest.testResolutionOfMultipleSizeValidators()
ValidatorResolutionTest.testResolutionOfMinMaxForDifferentTypes()
e)

If no ConstraintValidator compliant with T is found amongst the ConstraintValidators listed by the constraint A, an UnexpectedTypeException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.validatorresolution
ValidatorResolutionTest.testUnexpectedTypeInValidatorResolution()
org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testUnexpectedTypeException()
f)

If more than one maximally specific ConstraintValidator is found, an UnexpectedTypeException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.validatorresolution
ValidatorResolutionTest.testAmbiguousValidatorResolution()

Section 5.1 - Validator API

a)

Validator implementations are thread-safe.

Section 5.1.1 - Validation methods

a)

<T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups) is used to validate a given object.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testMultipleViolationOfTheSameType()
b)

An IllegalArgumentException is thrown when null is passed for the object parameter or the varargs groups parameter.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testValidateWithNullValue()
ValidateTest.testValidateWithNullGroup()
ValidateTest.testPassingNullAsGroup()
c)

A Set containing all ConstraintViolation objects representing the failing constraints is returned, an empty Set is returned otherwise.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testMultipleViolationOfTheSameType()
ValidatePropertyTest.testValidateProperty()
ValidateTest.testMultipleConstraintViolationOfDifferentTypes()
d)

<T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, Class<?>... groups) validates a given field or property of an object.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidatePropertyTest.testValidateProperty()
e)

An IllegalArgumentException is thrown when validateProperty is called and object is null or propertyName is null empty or invalid or null is passed to the varargs groups parameter.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidatePropertyTest.testValidatePropertyWithInvalidPropertyPath()
ValidatePropertyTest.testPassingNullAsGroup()
ValidatePropertyTest.testIllegalArgumentExceptionIsThrownForNullValue()
ValidatePropertyTest.testValidatePropertyWithNullProperty()
ValidatePropertyTest.testValidatePropertyWithEmptyProperty()
f)

The property name is the JavaBeans property name (as defined by the JavaBeans Introspector class).

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidatePropertyTest.testValidatePropertyWithInvalidPropertyPath()
ValidatePropertyTest.testValidateProperty()
g)

@Valid is not honored by this method.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidatePropertyTest.testValidIsNotHonoredValidateProperty()
h)

<T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType, String propertyName, Object value, Class<?>... groups) validates the property referenced by propertyName present on beanType or any of its superclasses, if the property value were value.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateValueTest.testValidateValueSuccess()
ValidateValueTest.testValidateValueFailure()
ValidateValueTest.testValidateValue()
i)

An IllegalArgumentException is thrown when validateValue is called and object is null or propertyName is null empty or invalid or null is passed to the varargs groups parameter.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateValueTest.testValidateValueWithInvalidPropertyPath()
ValidateValueTest.testExistingPropertyWoConstraintsNorCascaded()
ValidateValueTest.testValidateValuePassingNullAsGroup()
ValidateValueTest.testValidateValueWithEmptyPropertyPath()
ValidateValueTest.testValidateValueWithNullObject()
ValidateValueTest.testValidateValueWithNullPropertyName()
j)

@Valid is not honored by this method.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateValueTest.testValidIsNotHonoredValidateValue()
k)

If some unrecoverable failure happens during validation, a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testUnexpectedExceptionsInValidateGetWrappedInValidationExceptions()
ValidatePropertyTest.testUnexpectedExceptionsInValidatePropertyGetWrappedInValidationExceptions()

Section 5.1.2 - Methods for validating method and constructor constraints

a)

<T> Set<ConstraintViolation<T>> validateParameters(T object, Method method, Object[] parameterValues, Class<?>... groups) validates the arguments (as given in parameterValues) for the parameters of a given method (identified by method).

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateParametersTest.testOneViolation()
ValidateParametersTest.testUnexpectedType()
b)

A set containing all ConstraintViolation objects representing the failing constraints is returned, an empty set is returned if no constraint violation occurred.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateParametersTest.testOneViolation()
ValidateParametersTest.testOneViolationFromCrossParameterConstraint()
ValidateParametersTest.testTwoViolations()
ValidateParametersTest.testTwoViolationsOnSameParameter()
ValidateParametersTest.testTwoConstraintsOfSameType()
ValidateParametersTest.testCrossParameterConstraintGivenSeveralTimes()
ValidateParametersTest.testNoViolations()
ValidateParametersTest.testValidationWithGroup()
ValidateParametersTest.testCrossParameterConstraintValidationWithGroup()
ValidateParametersTest.testValidationWithSeveralGroups()
c)

An IllegalArgumentException will be thrown if null is passed for any of the parameters.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateParametersTest.testNullPassedForObjectCausesException()
ValidateParametersTest.testNullPassedForMethodCausesException()
ValidateParametersTest.testNullPassedForParameterValuesCausesException()
ValidateParametersTest.testNullPassedForGroupsCausesException()
ValidateParametersTest.testNullPassedAsSingleGroupCausesException()
d)

<T> Set<ConstraintViolation<T>> validateReturnValue(T object, Method method, Object returnValue, Class<?>... groups) validates the return value (specified by returnValue) of a given method (identified by method).

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateReturnValueTest.testOneViolation()
ValidateReturnValueTest.testUnexpectedType()
e)

A set containing all ConstraintViolation objects representing the failing constraints is returned, an empty set is returned if no constraint violation occurred.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateReturnValueTest.testOneViolation()
ValidateReturnValueTest.testTwoViolations()
ValidateReturnValueTest.testTwoConstraintsOfSameType()
ValidateReturnValueTest.testNoViolations()
ValidateReturnValueTest.testValidationWithGroup()
ValidateReturnValueTest.testValidationWithSeveralGroups()
f)

An IllegalArgumentException will be thrown if null is passed for any of the parameters object, method and groups.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateReturnValueTest.testNullPassedForObjectCausesException()
ValidateReturnValueTest.testNullPassedForMethodCausesException()
ValidateReturnValueTest.testNullPassedForGroupsCausesException()
ValidateReturnValueTest.testNullPassedAsSingleGroupCausesException()
g)

<T> Set<ConstraintViolation<T>> validateConstructorParameters(Constructor<T> constructor, Object[] parameterValues, Class<?>... groups) validates the arguments (as given in parameterValues) for the parameters of a given constructor (identified by constructor).

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateConstructorParametersTest.testOneViolation()
ValidateConstructorParametersTest.testUnexpectedType()
h)

A set containing all ConstraintViolation objects representing the failing constraints is returned, an empty set is returned if no constraint violation occurred.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateConstructorParametersTest.testOneViolation()
ValidateConstructorParametersTest.testOneViolationFromCrossParameterConstraint()
ValidateConstructorParametersTest.testTwoViolations()
ValidateConstructorParametersTest.testTwoViolationsOnSameParameter()
ValidateConstructorParametersTest.testTwoConstraintsOfSameType()
ValidateConstructorParametersTest.testCrossParameterConstraintGivenSeveralTimes()
ValidateConstructorParametersTest.testNoViolations()
ValidateConstructorParametersTest.testValidationWithGroup()
ValidateConstructorParametersTest.testCrossParameterConstraintValidationWithGroup()
ValidateConstructorParametersTest.testValidationWithSeveralGroups()
i)

An IllegalArgumentException will be thrown if null is passed for any of the parameters.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateConstructorParametersTest.testNullPassedForConstructorCausesException()
ValidateConstructorParametersTest.testNullPassedForParameterValuesCausesException()
ValidateConstructorParametersTest.testNullPassedForGroupsCausesException()
ValidateConstructorParametersTest.testNullPassedAsSingleGroupCausesException()
j)

<T> Set<ConstraintViolation<T>> validateConstructorReturnValue(Constructor<T> constructor, T createdObject, Class<?>... groups) validates the object (specified by createdObject) of a given constructor (identified by constructor).

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateConstructorReturnValueTest.testOneViolation()
ValidateConstructorReturnValueTest.testUnexpectedType()
k)

A set containing all ConstraintViolation objects representing the failing constraints is returned, an empty set is returned if no constraint violation occurred.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateConstructorReturnValueTest.testOneViolation()
ValidateConstructorReturnValueTest.testTwoViolations()
ValidateConstructorReturnValueTest.testTwoConstraintsOfSameType()
ValidateConstructorReturnValueTest.testNoViolations()
ValidateConstructorReturnValueTest.testValidationWithGroup()
ValidateConstructorReturnValueTest.testValidationWithSeveralGroups()
l)

An IllegalArgumentException will be thrown if null is passed for any of the parameters.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateConstructorReturnValueTest.testNullPassedForConstructorCausesException()
ValidateConstructorReturnValueTest.testNullPassedForReturnValueCausesException()
ValidateConstructorReturnValueTest.testNullPassedForGroupsCausesException()
ValidateConstructorReturnValueTest.testNullPassedAsSingleGroupCausesException()
m)

None of those methods honor the XML configuration <validated-executables/> nor the presence of @ValidateExecutable. In other words, elements will be validated regardless of these settings when explicitly calling the validation methods.

Coverage

No tests exist for this assertion

Section 5.1.3 - groups

a)

All constraints belonging to the targeted group are applied during the 4.6.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateWithGroupsTest.testCorrectGroupsAreAppliedForValidate()
ValidateWithGroupsTest.testCorrectGroupsAreAppliedForValidateProperty()
ValidateWithGroupsTest.testCorrectGroupsAreAppliedForValidateValue()
b)

If no group is passed, the Default group is assumed.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateWithGroupsTest.testCorrectGroupsAreAppliedForValidate()
ValidateWithGroupsTest.testCorrectGroupsAreAppliedForValidateProperty()
ValidateWithGroupsTest.testCorrectGroupsAreAppliedForValidateValue()
c)

When more than one group is evaluated and passed to the various validate methods, order is not constrained.

Section 5.2 - ConstraintViolation

a)

The getMessage method returns the interpolated (localized) message for the failing constraint

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testConstraintViolation()
b)

The getMessageTemplate method returns the non-interpolated error message

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testConstraintViolation()
c)

The getRootBean method returns the root object being validated that led to the failing constraint

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testConstraintViolation()
d)Needs update

The getInvalidValue method returns the value (field, property, method/constructor parameter, method/constructor return value or validated object) being passed to isValid.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testConstraintViolation()
e)

For a cross-parameter constraint, an Object[] representing the method/constructor invocation arguments is returned.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateParametersTest.testGetInvalidValueForCrossParameterConstraint()
ValidateParametersTest.testGetInvalidValueForCrossParameterConstraintOnParameterlessMethod()
f)

getConstraintDescriptor provides access to the failing constraint metadata

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testConstraintViolation()
g)Needs update

The getPropertyPath method returns the Path object representing the navigation path from the root object to the failing object.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathWithConstraintViolationForRootObject()
PropertyPathTest.testPropertyPathTraversedObject()
PropertyPathTest.testPropertyPathWithList()
PropertyPathTest.testPropertyPathWithArray()
PropertyPathTest.testPropertyPathWithRuntimeTypeList()
PropertyPathTest.testPropertyPathWithMap()
PropertyPathTest.testPropertyPathSet()
PropertyPathTest.testPropertyPathForMethodParameterConstraint()
PropertyPathTest.testPropertyPathForMethodParameterConstraintWithCustomParameterNameProvider()
PropertyPathTest.testPropertyPathForMethodReturnValueConstraint()
PropertyPathTest.testPropertyPathForConstructorParameterConstraint()
PropertyPathTest.testPropertyPathForConstructorParameterConstraintWithCustomParameterNameProvider()
PropertyPathTest.testPropertyPathForConstructorReturnValueConstraint()
PropertyPathTest.testPropertyPathTraversingMethodParameter()
PropertyPathTest.testPropertyPathTraversingMethodListParameter()
PropertyPathTest.testPropertyPathTraversingMethodArrayParameter()
PropertyPathTest.testPropertyPathTraversingMethodSetParameter()
PropertyPathTest.testPropertyPathTraversingMethodMapParameter()
PropertyPathTest.testPropertyPathTraversingConstructorParameter()
PropertyPathTest.testPropertyPathTraversingConstructorListParameter()
PropertyPathTest.testPropertyPathTraversingConstructorArrayParameter()
PropertyPathTest.testPropertyPathTraversingConstructorSetParameter()
PropertyPathTest.testPropertyPathTraversingConstructorMapParameter()
PropertyPathTest.testPropertyPathTraversingMethodReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodListReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodArrayReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodSetReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodMapReturnValue()
PropertyPathTest.testPropertyPathTraversingConstructorReturnValue()
org.hibernate.beanvalidation.tck.tests.methodvalidation
ValidateConstructorParametersTest.testGetInvalidValueForCrossParameterConstraint()
ValidateConstructorParametersTest.testGetInvalidValueForCrossParameterConstraintOnParameterlessMethod()
h)

The runtime type is considered, not the static type. For example if a property is declared Collection<String> but its runtime type is ArrayList<String>, the property is considered an ArrayList<String>.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathWithRuntimeTypeList()
i)Needs update

If the failing object is the root object, a Node with name set to null is added to the Path. The Kind of the node's ElementDescriptor is Kind.BEAN.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathWithConstraintViolationForRootObject()
j)Needs update

A Node object whose name equals the name of the association property (field name or Java Bean property name) is added to Path. The Kind of the node's ElementDescriptor is Kind.PROPERTY.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathTraversedObject()
k)

If the association is a List or an array, the following Node object added contains the index value in getIndex.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathWithList()
PropertyPathTest.testPropertyPathWithArray()
PropertyPathTest.testPropertyPathWithRuntimeTypeList()
l)

If the association is a Map, the following Node object added (representing a given map entry) contains the key value in getKey

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathWithMap()
m)

For all Iterable or Map, the following Node object added is marked as inIterable (isInIterable)

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathWithList()
PropertyPathTest.testPropertyPathWithArray()
PropertyPathTest.testPropertyPathWithRuntimeTypeList()
PropertyPathTest.testPropertyPathWithMap()
PropertyPathTest.testPropertyPathSet()
n)Needs update

For a property level constraint (field and getter) a Node object is added to Path whose name equals the name of the property (field name or Java Bean property name). The Kind of the node's ElementDescriptor is Kind.PROPERTY. the property path is considered complete

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathTraversedObject()
PropertyPathTest.testPropertyPathTraversingMethodParameter()
PropertyPathTest.testPropertyPathTraversingMethodListParameter()
PropertyPathTest.testPropertyPathTraversingMethodArrayParameter()
PropertyPathTest.testPropertyPathTraversingMethodSetParameter()
PropertyPathTest.testPropertyPathTraversingMethodMapParameter()
PropertyPathTest.testPropertyPathTraversingConstructorParameter()
PropertyPathTest.testPropertyPathTraversingConstructorListParameter()
PropertyPathTest.testPropertyPathTraversingConstructorArrayParameter()
PropertyPathTest.testPropertyPathTraversingConstructorSetParameter()
PropertyPathTest.testPropertyPathTraversingConstructorMapParameter()
PropertyPathTest.testPropertyPathTraversingMethodReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodListReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodArrayReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodSetReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodMapReturnValue()
PropertyPathTest.testPropertyPathTraversingConstructorReturnValue()
o)Needs update

For a class level constraint: a Node object is added to Path whose name is null. The Kind of the node's ElementDescriptor is Kind.BEAN. the property path is considered complete

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathWithConstraintViolationForRootObject()
p)

A Node object is added to the Path which represents the validated method or constructor. The name of the node equals the validated method or constructor, the Kind of the node's ElementDescriptor is Kind.METHOD respectively Kind.CONSTRUCTOR.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathForMethodParameterConstraint()
PropertyPathTest.testPropertyPathForMethodReturnValueConstraint()
PropertyPathTest.testPropertyPathForConstructorParameterConstraint()
PropertyPathTest.testPropertyPathForConstructorReturnValueConstraint()
q)

A Node object is added to the Path which represents the validated parameter or return value. In the parameter case, the name of the node equals the parameter name as determined by the current parameter name provider (see 4.5.2.2). In the return value case, the name of the node is null. The Kind of the node's ElementDescriptor is Kind.PARAMETER respectively Kind.RETURN_VALUE.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathForMethodParameterConstraint()
PropertyPathTest.testPropertyPathForMethodParameterConstraintWithCustomParameterNameProvider()
PropertyPathTest.testPropertyPathForMethodReturnValueConstraint()
PropertyPathTest.testPropertyPathForConstructorParameterConstraint()
PropertyPathTest.testPropertyPathForConstructorParameterConstraintWithCustomParameterNameProvider()
PropertyPathTest.testPropertyPathForConstructorReturnValueConstraint()
r)

The property path is considered complete

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathForMethodParameterConstraint()
PropertyPathTest.testPropertyPathForMethodParameterConstraintWithCustomParameterNameProvider()
PropertyPathTest.testPropertyPathForMethodReturnValueConstraint()
PropertyPathTest.testPropertyPathForConstructorParameterConstraint()
PropertyPathTest.testPropertyPathForConstructorParameterConstraintWithCustomParameterNameProvider()
PropertyPathTest.testPropertyPathForConstructorReturnValueConstraint()
s)

A Node object is added to the Path which represents the concerned method or constructor. The name of the node equals the concerned method or constructor, the Kind of the node's ElementDescriptor is Kind.METHOD respectively Kind.CONSTRUCTOR.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathTraversingMethodParameter()
PropertyPathTest.testPropertyPathTraversingMethodListParameter()
PropertyPathTest.testPropertyPathTraversingMethodArrayParameter()
PropertyPathTest.testPropertyPathTraversingMethodSetParameter()
PropertyPathTest.testPropertyPathTraversingMethodMapParameter()
PropertyPathTest.testPropertyPathTraversingConstructorParameter()
PropertyPathTest.testPropertyPathTraversingConstructorListParameter()
PropertyPathTest.testPropertyPathTraversingConstructorArrayParameter()
PropertyPathTest.testPropertyPathTraversingConstructorSetParameter()
PropertyPathTest.testPropertyPathTraversingConstructorMapParameter()
PropertyPathTest.testPropertyPathTraversingMethodReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodListReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodArrayReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodSetReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodMapReturnValue()
PropertyPathTest.testPropertyPathTraversingConstructorReturnValue()
t)

A Node object is added to the Path which represents the traversed parameter or return value. In the parameter case, the name of the node equals the parameter name as determined by the current parameter name provider. In the return value case, the name of the node is null. The Kind of the node's ElementDescriptor is Kind.PARAMETER respectively Kind.RETURN_VALUE.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathTraversingMethodParameter()
PropertyPathTest.testPropertyPathTraversingMethodListParameter()
PropertyPathTest.testPropertyPathTraversingMethodArrayParameter()
PropertyPathTest.testPropertyPathTraversingMethodSetParameter()
PropertyPathTest.testPropertyPathTraversingMethodMapParameter()
PropertyPathTest.testPropertyPathTraversingConstructorParameter()
PropertyPathTest.testPropertyPathTraversingConstructorListParameter()
PropertyPathTest.testPropertyPathTraversingConstructorArrayParameter()
PropertyPathTest.testPropertyPathTraversingConstructorSetParameter()
PropertyPathTest.testPropertyPathTraversingConstructorMapParameter()
PropertyPathTest.testPropertyPathTraversingMethodReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodListReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodArrayReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodSetReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodMapReturnValue()
PropertyPathTest.testPropertyPathTraversingConstructorReturnValue()
u)

If the parameter/return value is a List or an array, the following Node object added contains the index value in getIndex.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathTraversingMethodListParameter()
PropertyPathTest.testPropertyPathTraversingMethodArrayParameter()
PropertyPathTest.testPropertyPathTraversingConstructorListParameter()
PropertyPathTest.testPropertyPathTraversingConstructorArrayParameter()
PropertyPathTest.testPropertyPathTraversingMethodListReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodArrayReturnValue()
v)

If the parameter/return value is a Map, the following Node object added (representing a given map entry) contains the key value ingetKey.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathTraversingMethodMapParameter()
PropertyPathTest.testPropertyPathTraversingConstructorMapParameter()
PropertyPathTest.testPropertyPathTraversingMethodMapReturnValue()
w)

For all Iterable or Map, the following Node object added is marked as inIterable (isInIterable)

Coverage

org.hibernate.beanvalidation.tck.tests.validation
PropertyPathTest.testPropertyPathTraversingMethodListParameter()
PropertyPathTest.testPropertyPathTraversingMethodArrayParameter()
PropertyPathTest.testPropertyPathTraversingMethodSetParameter()
PropertyPathTest.testPropertyPathTraversingMethodMapParameter()
PropertyPathTest.testPropertyPathTraversingConstructorListParameter()
PropertyPathTest.testPropertyPathTraversingConstructorArrayParameter()
PropertyPathTest.testPropertyPathTraversingConstructorSetParameter()
PropertyPathTest.testPropertyPathTraversingConstructorMapParameter()
PropertyPathTest.testPropertyPathTraversingMethodListReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodArrayReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodSetReturnValue()
PropertyPathTest.testPropertyPathTraversingMethodMapReturnValue()
x)

Bean Validation implementations should ensure that a ConstraintViolation implementation is Serializable provided that the root bean, the leaf bean, the invalid value and keys in the Path object are Serializable objects.

Section 5.3.1 - Default message interpolation

a)

Every conforming Bean Validation implementation includes a default message interpolator which has to comply with

Coverage

org.hibernate.beanvalidation.tck.tests.messageinterpolation
MessageInterpolationTest.testDefaultMessageInterpolatorIsNotNull()
b)

Each constraint defines a message descriptor via its message property.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithoutMessageParameter()
c)

Every constraint definition shall define a default message descriptor for that constraint.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithoutMessageParameter()
d)

Messages can be overridden at constraint declaration time by setting the message property on the constraint.

Coverage

org.hibernate.beanvalidation.tck.tests.messageinterpolation
MessageInterpolationTest.testMessagesCanBeOverriddenAtConstraintLevel()
e)Needs update (GM: manually added this note)

The message descriptor is a string literal and may contain one or more message parameters or expressions. Message parameters and expressions are string literals enclosed in {} or ${} respectively.

Coverage

org.hibernate.beanvalidation.tck.tests.messageinterpolation
MessageInterpolationTest.testSuccessfulInterpolationOfValidationMessagesValue()
f)

\{ is considered as the literal { instead of being considered as the beginning of a message parameter

Coverage

org.hibernate.beanvalidation.tck.tests.messageinterpolation
MessageInterpolationTest.testLiteralCurlyBraces()
g)

\} is considered as the literal } instead of being considered as the end of a message parameter

Coverage

org.hibernate.beanvalidation.tck.tests.messageinterpolation
MessageInterpolationTest.testLiteralCurlyBraces()
h)

\\ is considered as the literal \ instead of being considered as the escaping character

Coverage

org.hibernate.beanvalidation.tck.tests.messageinterpolation
MessageInterpolationTest.testLiteralCurlyBraces()
i)

\$ is considered as the literal $ instead of being considered as the beginning of a message expression

Coverage

No tests exist for this assertion

Section 5.3.1.1 - Default message interpolation algorithm

a)

Message parameters are extracted from the message string and used as keys to search the ResourceBundle named ValidationMessages

Coverage

org.hibernate.beanvalidation.tck.tests.messageinterpolation
MessageInterpolationTest.testSuccessfulInterpolationOfValidationMessagesValue()
MessageInterpolationTest.testUnSuccessfulInterpolation()
MessageInterpolationTest.testUnknownTokenInterpolation()
b)

Step 1 is applied recursively until no replacement is performed

Coverage

org.hibernate.beanvalidation.tck.tests.messageinterpolation
MessageInterpolationTest.testRecursiveMessageInterpolation()
c)

Message parameters are extracted from the message string and used as keys to search the Bean Validation provider's built-in ResourceBundle using the defined locale (see 5.3.1.2). If a property is found, the message parameter is replaced with the property value in the message string.

Coverage

org.hibernate.beanvalidation.tck.tests.messageinterpolation
MessageInterpolationTest.testParametersAreExtractedFromBeanValidationProviderBundle()
d)

Contrary to step 1, step 2 is not processed recursively.

e)

If step 2 triggers a replacement, then step 1 is applied again.

f)Needs update (GM: manually added this note)

Message parameters are extracted from the message string. Those matching the name of an attribute of the constraint are replaced by the value of that attribute in the constraint declaration. Parameter interpolation has precedence over message expressions. For example for the message descriptor ${value}, trying to evaluate {value} as message parameter has precedence over evaluating ${value} as message expression.

Coverage

org.hibernate.beanvalidation.tck.tests.messageinterpolation
MessageInterpolationTest.testConstraintAttributeValuesAreInterpolated()
g)

Message expressions are extracted from the message string and evaluated using Expression Language. See also .

Coverage

No tests exist for this assertion

Section 5.3.1.2 - Locale for default message interpolation

a)

If the locale is passed explicitly to the interpolator method via interpolate(String, Context, Locale), this provided instance is used.

Coverage

org.hibernate.beanvalidation.tck.tests.messageinterpolation
MessageInterpolationTest.testMessageInterpolationWithLocale()
b)

Otherwise, the default Locale as provided by Locale.getDefault() is used.

Coverage

org.hibernate.beanvalidation.tck.tests.messageinterpolation
MessageInterpolationTest.testIfNoLocaleIsSpecifiedTheDefaultLocaleIsAssumed()

Section 5.3.1.3 - Message expressions using Expression Language (EL)

a)

The default message interpolation allows the use of Expression Language (EL) as defined as

Coverage

No tests exist for this assertion

b)

Expressions to be evaluated by EL need to be enclosed in ${} within the message descriptor

Coverage

No tests exist for this assertion

c)

The attribute values of the constraint declaration mapped to their attribute name

Coverage

No tests exist for this assertion

d)

The validated value mapped under the name validatedValue.

Coverage

No tests exist for this assertion

e)

A bean mapped to the name formatter exposing the vararg method format(String format, Object... args). This method must behave like java.util.Formatter#format(String format, Object... args). The locale used for formatting is defined by 5.3.1.2. The formatter bean allows to format property values, for example in the case of the validated value being 98.12345678, ${formatter.format("%1$2f", validatedValue} would format it to 98.12 (two digits after the decimal point, where the use of '.' vs ',' would be locale specific).

Coverage

No tests exist for this assertion

Section 5.3.2 - Custom message interpolation

a)

A message interpolator implementation shall be thread-safe.

b)

It is possible to override the MessageInterpolator implementation for a given Validator instance by invoking ValidatorFactory.usingContext().messageInterpolator(messageInterpolator).getValidator().

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
CustomMessageInterpolatorTest.testCustomMessageInterpolatorViaValidatorContext()
CustomMessageInterpolatorTest.testCustomMessageInterpolatorViaConfiguration()

Section 5.5 - Bootstrapping

a)

A bootstrap implementation must be able to bootstrap any Bean Validation provider implementation.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap.customprovider
BootstrapCustomProviderDefinedInValidationXmlTest.testGetFactoryByProviderSpecifiedInValidationXml()
BootstrapCustomProviderDefinedInServiceFileTest.testGetFactoryByProviderSpecifiedProgrammatically()

Section 5.5.1 - Examples

a)

The ValidatorFactory object is thread-safe.

Section 5.5.2 - ValidatorFactory

a)

getMessageInterpolator() returns the MessageInterpolator instance configured during the initialization of the ValidatorFactory.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
CustomMessageInterpolatorTest.testCustomMessageInterpolatorViaValidatorContext()
b)

getParameterNameProvider() returns the ParameterNameProvider instance configured during the initialization of the ValidatorFactory.

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation.parameternameprovider
ParameterNameProviderTest.testGetParameterNameProviderFromValidatorFactory()
c)Needs update

The MessageInterpolator, the TraversableResolver, the ConstraintValidatorFactory or the ParameterNameProvider passed to the ValidatorContext are used instead of the ValidatorFactory's MessageInterpolator, TraversableResolver, ConstraintValidatorFactory or ParameterNameProvider instances.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
CustomMessageInterpolatorTest.testCustomMessageInterpolatorViaValidatorContext()

Section 5.5.3 - Configuration

a)

Configuration does provide a ParameterNameProvider implementation following the default Bean Validation ParameterNameProvider rules as defined in 4.5.2.2. You can access it by calling getDefaultParameterNameProvider()

Coverage

org.hibernate.beanvalidation.tck.tests.methodvalidation.parameternameprovider
DefaultParameterNameProviderTest.testGetDefaultParameterNameProviderFromConfiguration()
b)

Via getBootstrapConfiguration(), Configuration also exposes data stored in META-INF/validation.xml

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
BootstrapConfigurationWithValidatedExecutableTypesContainingALLTest.testGetValidatedExecutableTypesReturnsSetWithAllOptionsIfALLIsContained()
BootstrapConfigurationWithEmptyValidatedExecutableTypesTest.testEmptyExecutableTypesCauseValidationException()
BootstrapConfigurationWithoutValidationXmlTest.testGetBootstrapConfigurationNoValidationXml()
BootstrapConfigurationWithValidatedExecutableTypesContainingNONETest.testGetValidatedExecutableTypesReturnsEmptySetIfNONEIsContained()
BootstrapConfigurationWithValidatedExecutableTypesContainingALLAndNONETest.testGetValidatedExecutableTypesReturnsSetWithAllOptionsIfALLAndNONEAreContained()
BootstrapConfigurationTest.testGetBootstrapConfiguration()
BootstrapConfigurationWithValidatedExecutableTypesContainingSomeTest.testGetValidatedExecutableTypesReturnsSetWithConfiguredValues()
c)

Using addMapping(), additional constraint mapping XML descriptors can be added to the configuration

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
ConfigurationTest.testMappingsCanBeAddedViaConfiguration()
d)

Streams not supporting the mark() and reset() methods will be wrapped with an InputStream implementation supporting these methods by the Bean Validation provider in order to allow the streams to be read several times.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
ConfigurationTest.testNonResettableInputStreamCanBeAddedViaConfigurationAndFactoryCanBeCreatedSeveralTimes()
e)

It is legal to invoke buildValidatorFactory() several times, e.g. in order to retrieval several ValidatorFactory instances with a slightly different configuration (see ).

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
ConfigurationTest.testSeveralFactoriesCanBeBuildFromOneConfiguration()
f)

A Bean Validation provider must define a sub interface of Configuration uniquely identifying the provider.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
ConfigurationTest.testProviderUnderTestDefinesSubInterfaceOfConfiguration()
g)

Streams represented in the XML configuration and opened by the Configuration implementation must be closed by the Configuration implementation after the ValidatorFactory creation (or if an exception occurs).

h)

If no ValidationProviderResolver instance has been specified, the default ValidationProviderResolver is used.

Section 5.5.4.1 - ValidationProviderResolver

a)

ValidationProviderResolver returns the list of Bean Validation providers available at runtime and more specifically a ValidationProvider instance for each provider available in the context.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap.customprovider
BootstrapCustomProviderDefinedInServiceFileTest.testProviderResolverReturnsListOfAvailableProviders()
b)

Implementations must be thread-safe.

c)

Bean Validation providers must supply a service provider configuration file by creating a text file javax.validation.spi.ValidationProvider and placing it in the META-INF/services directory of one of its jar files.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
ValidationProviderResolverTest.testServiceFileExists()

Section 5.5.4.2 - ValidationProvider

a)

A client can request a specific Bean Validation provider by using <T extends Configuration<T>, U extends ValidationProvider<T>> Validation.byProvider(Class<U>) or by defining the provider in the XML configuration file.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap.customprovider
BootstrapCustomProviderDefinedInValidationXmlTest.testGetFactoryByProviderSpecifiedInValidationXml()
BootstrapCustomProviderDefinedInServiceFileTest.testGetFactoryByProviderSpecifiedProgrammatically()
b)

The provider discovery mechanism uses the following algorithm: Retrieve available providers using ValidationProviderResolver.getValidationProviders(). The first ValidationProvider matching the requested provider is returned. Providers are evaluated in the order they are returned by ValidationProviderResolver. A provider instance is considered matching if it is assignable to the requested provider class.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
ValidationProviderTest.testFirstMatchingValidationProviderResolverIsReturned()
c)

When the default Bean Validation provider is requested, the first ValidationProvider returned by the ValidationProviderResolver strategy is returned.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
ValidationProviderTest.testByDefaultProviderUsesTheFirstProviderReturnedByValidationProviderResolver()
d)

Every Bean Validation provider must provide a ValidationProvider implementation containing a public no-arg constructor

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
ValidationProviderTest.testValidationProviderContainsNoArgConstructor()
e)

If a problem occurs while building the ValidatorFactory, a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
ValidationProviderTest.testValidationExceptionIsThrownInCaseValidatorFactoryCreationFails()

Section 5.5.5 - Validation

a)

The first entry point, buildDefaultValidatorFactory(), is considered to be the default ValidatorFactory and is equivalent to the ValidatorFactory returned by Validation.byDefaultProvider().configure().buildValidatorFactory().

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidationTest.testBuildDefaultValidatorFactory()
b)

The second entry point lets the client provide a custom ValidationProviderResolution instance. This instance is passed to GenericBootstrap. GenericBootstrap builds a generic Configuration using the first ValidationProvider returned by ValidationProviderResolution and calling ValidationProvider.createGenericConfiguration(BootstrapState state).

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidationTest.testCustomValidationProviderResolution()
c)

The last entry point lets the client define the specific Bean Validation provider requested as well as a custom ValidationProviderResolver implementation if needed. The entry point method, Validation.byProvider(Class<U> providerType), takes the provider specific ValidationProvider implementation type and returns a ProviderSpecificBootstrap object that guarantees to return an instance of the specific Configuration sub interface.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidationTest.testSpecificValidationProvider()
d)

The Validation implementation must not contain any non private attribute or method aside from the three public static bootstrap methods

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidationTest.testVerifyMethodsOfValidationObjects()
e)

The bootstrap implementation must ensure it can bootstrap third party providers.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidationTest.testCustomValidationProviderResolution()
ValidationTest.testSpecificValidationProvider()
f)Needs update

When bootstrapping a Bean Validation provider, if the ValidationProviderResolver either fails or if the expected provider is not found, a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap
ValidationProviderTest.testValidationExceptionIsThrownInCaseValidatorFactoryCreationFails()
org.hibernate.beanvalidation.tck.tests.bootstrap.customprovider
BootstrapNonAvailableValidationProviderTest.testUnknownProviderConfiguredInValidationXml()
BootstrapNonAvailableValidationProviderTest.testConfiguredValidationProviderIsNotLoadable()

Section 5.5.6 - XML Configuration: META-INF/validation.xml

a)

Unless explicitly ignored by calling Configuration.ignoreXMLConfiguration(), a Configuration takes into account the configuration available in META-INF/validation.xml.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
XmlConfigurationTest.testClassConstraintDefinedInXml()
XmlConfigurationTest.testIgnoreValidationXml()
XmlConfigurationTest.testPropertyConstraintDefinedInXml()
XmlConfigurationTest.testFieldConstraintDefinedInXml()
XmlConfigurationTest.testAnnotationDefinedConstraintApplies()
XmlConfigurationTest.testCascadingConfiguredInXml()
b)

This configuration file is optional

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
OptionalValidationXmlTest.testIgnoreValidationXml()
c)

If more than one META-INF/validation.xml file is found in the classpath, a ValidationException is raised.

d)

Unless stated otherwise, XML based configuration settings are overridden by values explicitly set via the Configuration API.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
MessageInterpolatorSpecifiedInValidationXmlTest.testMessageInterpolatorSpecifiedInValidationXmlCanBeOverridden()
TraversableResolverSpecifiedInValidationXmlTest.testTraversableResolverSpecifiedInValidationXmlCanBeOverridden()
e)

default-provider: represents the class name of the provider specific ValidationProvider implementation class. If defined, the specific provider is used

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
DefaultProviderSpecifiedInValidationXmlTest.testProviderSpecifiedInValidationXml()
f)

message-interpolator: represents the fully qualified class name of the MessageInterpolator implementation. When defined in XML, the implementation must have a public no-arg constructor.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
MessageInterpolatorSpecifiedInValidationXmlTest.testMessageInterpolatorSpecifiedInValidationXmlCanBeOverridden()
MessageInterpolatorSpecifiedInValidationXmlNoDefaultConstructorTest.testMessageInterpolatorSpecifiedInValidationXmlHasNoDefaultConstructor()
MessageInterpolatorSpecifiedInValidationXmlTest.testMessageInterpolatorSpecifiedInValidationXml()
g)

traversable-resolver: represents the fully qualified class name of the TraversableResolver implementation. When defined in XML, the implementation must have a public no-arg constructor.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
TraversableResolverSpecifiedInValidationXmlTest.testTraversableResolverSpecifiedInValidationXmlCanBeOverridden()
ConstraintValidatorFactorySpecifiedInValidationXmlTest.testConstraintValidatorFactorySpecifiedInValidationXmlCanBeOverridden()
TraversableResolverSpecifiedInValidationXmlNoDefaultConstructorTest.testTraversableResolverSpecifiedInValidationXmlHasNoDefaultConstructor()
TraversableResolverSpecifiedInValidationXmlTest.testTraversableResolverSpecifiedInValidationXml()
h)

constraint-validator-factory: represents the fully qualified class name of the ConstraintValidatorFactory implementation. When defined in XML, the implementation must have a public no-arg constructor.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
ConstraintValidatorFactorySpecifiedInValidationXmlTest.testConstraintValidatorFactorySpecifiedInValidationXmlCanBeOverridden()
ConstraintValidatorFactorySpecifiedInValidationXmlTest.testConstraintValidatorFactorySpecifiedInValidationXml()
i)

parameter-name-provider: represents the fully qualified class name of the ParameterNameProvider implementation. When defined in XML, the implementation must have a public no-arg constructor.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
ParameterNameProviderSpecifiedInValidationXmlTest.testParameterNameSpecifiedInValidationXml()
j)

validated-executables contains the list of executable-type that are considered by default by the integration technology validating executables upon execution.

Coverage

No tests exist for this assertion

k)Needs update

message-interpolator, traversable-resolver, constraint-validator-factory, parameter-name-provider and validated-executables are optional.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
DefaultProviderSpecifiedInValidationXmlTest.testProviderSpecifiedInValidationXml()
l)

constraint-mapping: represents the resource path of an XML mapping file.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
XmlConfigurationTest.testClassConstraintDefinedInXml()
XmlConfigurationTest.testIgnoreValidationXml()
XmlConfigurationTest.testPropertyConstraintDefinedInXml()
XmlConfigurationTest.testFieldConstraintDefinedInXml()
XmlConfigurationTest.testAnnotationDefinedConstraintApplies()
XmlConfigurationTest.testCascadingConfiguredInXml()
m)

More than one constraint-mapping element can be present.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
XmlConfigurationTest.testClassConstraintDefinedInXml()
XmlConfigurationTest.testIgnoreValidationXml()
XmlConfigurationTest.testPropertyConstraintDefinedInXml()
XmlConfigurationTest.testFieldConstraintDefinedInXml()
XmlConfigurationTest.testAnnotationDefinedConstraintApplies()
XmlConfigurationTest.testCascadingConfiguredInXml()
n)

Mappings provided via Configuration.addMapping(InputStream) are added to the list of mappings described via constraint-mapping.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
XmlConfigurationTest.testMappingFilesAddedViaConfigurationGetAddedToXmlConfiguredMappings()
o)

The namespace javax.validation is reserved for use by this specification.

p)Needs update

Properties defined via Configuration.addProperty(String, String) are added to the properties defined via property.

q)Needs update

If a property with the same name are defined in both XML and via the programmatic API, the value provided via programmatic API has priority.

r)

If a public no-arg constructor is missing, a ValidationException is raised during the Configuration.buildValidatorFactory() call.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
MessageInterpolatorSpecifiedInValidationXmlNoDefaultConstructorTest.testMessageInterpolatorSpecifiedInValidationXmlHasNoDefaultConstructor()
TraversableResolverSpecifiedInValidationXmlNoDefaultConstructorTest.testTraversableResolverSpecifiedInValidationXmlHasNoDefaultConstructor()

Section 5.5.7 - Bootstrapping considerations

a)

ValidatorFactory is a thread-safe object that should be built once per deployment unit

b)

Validator is a thread-safe and lightweight object which can be cached by the ValidatorFactory instance.

Section 6.1 - Validator

a)

getConstraintsForClass returns a BeanDescriptor object describing the bean level constraints (see 4.1.1) and providing access to the property level constraints metadata.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
BeanDescriptorTest.testIsBeanConstrainedDueToValidAnnotation()
BeanDescriptorTest.testIsBeanConstrainedDueToConstraintOnEntity()
BeanDescriptorTest.testIsBeanConstrainedDueToConstraintProperty()
BeanDescriptorTest.testIsBeanConstrainedDueToConstraintOnInterface()
BeanDescriptorTest.testUnconstrainedClass()
BeanDescriptorTest.testGetConstraintsForConstrainedProperty()
BeanDescriptorTest.testGetConstraintsForNonExistingProperty()
BeanDescriptorTest.testGetConstrainedProperties()
BeanDescriptorTest.testGetConstrainedPropertiesForUnconstrainedEntity()
org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testConstraintDescriptorWithoutExplicitGroup()
b)

An IllegalArgumentException is raised if the clazz parameter is null.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testNullParameterToGetConstraintsForClass()
c)

If a constraint definition or declaration hosted by the requested class (or any of it's superclasses and interfaces according to the constraint propagation rules) is invalid, a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.validation
ValidateTest.testUnexpectedTypeException()

Section 6.2 - ElementDescriptor

a)

getElementClass returns either the object type for a class, or the returned type for a property.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ElementDescriptorTest.testGetElementClass()
b)

getConstraintDescriptors returns all the ConstraintDescriptors (see 6.10) hosted on the given element in the class hierarchy, each ConstraintDescriptor describing one of the constraints declared on the given element.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ElementDescriptorTest.testGetConstraintDescriptors()
c)

hasConstraints returns true if the given element (class, field or property) in the class hierarchy holds at least one constraint declaration.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ElementDescriptorTest.testHasConstraints()
d)

getKind returns the concrete type of the given element.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
BeanDescriptorTest.testGetKind()
ExecutableDescriptorTest.testGetKindForMethod()
ExecutableDescriptorTest.testGetKindForConstructor()
ReturnValueDescriptorTest.testGetKind()
PropertyDescriptorTest.testGetKind()
ParameterDescriptorTest.testGetKind()
e)

The method as returns the given element casted down to one of the specific descriptor types, e.g. BeanDescriptor, PropertyDescriptor etc.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
BeanDescriptorTest.testAs()
BeanDescriptorTest.testAsWithWrongType()
ExecutableDescriptorTest.testAsForMethod()
ExecutableDescriptorTest.testAsForConstructor()
ExecutableDescriptorTest.testAsForMethodWithWrongType()
ExecutableDescriptorTest.testAsForConstructorWithWrongType()
ReturnValueDescriptorTest.testAs()
ReturnValueDescriptorTest.testAsWithWrongType()
PropertyDescriptorTest.testAs()
PropertyDescriptorTest.testAsWithWrongType()
ParameterDescriptorTest.testAs()
ParameterDescriptorTest.testAsWithWrongType()
f)

unorderedAndMatchingGroups restricts to the ConstraintDescriptors (see 6.10) matching the set of groups passed as parameters and present on the element. Order is not respected but group inheritance and inheritance via sequence (including the Default group overriding at the class level) are honored.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ElementDescriptorTest.testUnorderedAndMatchingGroups()
ElementDescriptorTest.testUnorderedAndMatchingGroupsWithInheritance()
ElementDescriptorTest.testUnorderedAndMatchingGroupsWithDefaultGroupOverriding()
g)

declaredOn lets you restrict the list of element types constraints are hosted on.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ElementDescriptorTest.testDeclaredOn()
h)

lookingAt lets you restrict which constraints are considered. Either constraints belonging to the element but hosted on the class represented by BeanDescritptor (Scope.LOCAL_ELEMENT), or constraints belonging to the element but hosted anywhere in the class hierarchy (Scope.HIERARCHY).

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ElementDescriptorTest.testLookingAt()

Section 6.3 - BeanDescriptor

a)

isBeanConstrained returns true if the given class (and superclasses and interfaces) hosts at least one validation declaration (either constraint or @Valid annotation).

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
BeanDescriptorTest.testIsBeanConstrainedDueToValidAnnotation()
BeanDescriptorTest.testIsBeanConstrainedDueToConstraintOnEntity()
BeanDescriptorTest.testIsBeanConstrainedDueToConstraintProperty()
BeanDescriptorTest.testIsBeanConstrainedDueToConstraintOnInterface()
BeanDescriptorTest.testUnconstrainedClass()
b)

getConstraintsForProperty returns a PropertyDescriptor object describing the property level constraints (See 4.1.2). The property is uniquely identified by its name as per the JavaBeans convention: field level and getter level constraints of the given name are all returned.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
BeanDescriptorTest.testGetConstraintsForConstrainedProperty()
BeanDescriptorTest.testGetConstraintsForUnConstrainedProperty()
BeanDescriptorTest.testGetConstraintsForNonExistingProperty()
BeanDescriptorTest.testGetConstrainedProperties()
BeanDescriptorTest.testGetConstrainedPropertiesForUnconstrainedEntity()
c)

An IllegalArgumentException is raised if the propertyName parameter is null.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
BeanDescriptorTest.testGetConstraintsForNullProperty()
d)

getConstraintsForMethod returns a MethodDescriptor object describing the method constraints of the given method. The method is uniquely identified by its name and the types of its parameters.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
BeanDescriptorTest.testGetConstraintsForParameterConstrainedMethod()
BeanDescriptorTest.testGetConstraintsForCrossParameterConstrainedMethod()
BeanDescriptorTest.testGetConstraintsForCascadedParameterMethod()
BeanDescriptorTest.testGetConstraintsForReturnValueConstrainedMethod()
BeanDescriptorTest.testGetConstraintsForCascadedReturnValueMethod()
BeanDescriptorTest.testGetConstraintsForUnconstrainedMethod()
BeanDescriptorTest.testGetConstraintsForNonExistingMethod()
BeanDescriptorTest.testGetConstraintsForNullMethod()
e)

getConstrainedMethods returns the MethodDescriptors of the methods having at least one constraint or cascaded parameter or return value.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
BeanDescriptorTest.testGetConstrainedMethods()
BeanDescriptorTest.testGetConstrainedMethodsForUnconstrainedEntity()
f)

getConstraintsForConstructor returns a ConstructorDescriptor ojbect describing the method constraints of the given constructor. The constructor is uniquely identified by its name and the types of its parameters.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
BeanDescriptorTest.testGetConstraintsForParameterConstrainedConstructor()
BeanDescriptorTest.testGetConstraintsForCrossParameterConstrainedConstructor()
BeanDescriptorTest.testGetConstraintsForCascadedParameterConstructor()
BeanDescriptorTest.testGetConstraintsForReturnValueConstrainedConstructor()
BeanDescriptorTest.testGetConstraintsForCascadedReturnValueConstructor()
BeanDescriptorTest.testGetConstraintsForUnconstrainedConstructor()
BeanDescriptorTest.testGetConstraintsForNonExistingConstructorConstructor()
g)

getConstrainedConstructors returns the ConstructorDescriptors of the constructors having at least one constraint or cascaded parameter or return value.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
BeanDescriptorTest.testGetConstrainedConstructors()
BeanDescriptorTest.testGetConstrainedConstructorsForUnconstrainedEntity()

Section 6.4 - CascadableDescriptor

a)

The isCascaded method returns true if the element is marked with @Valid.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
BeanDescriptorTest.testGetConstraintsForUnConstrainedProperty()
ReturnValueDescriptorTest.testIsCascadedForMethodReturnValue()
ReturnValueDescriptorTest.testIsCascadedForConstructorReturnValue()
PropertyDescriptorTest.testIsNotCascaded()
PropertyDescriptorTest.testIsCascaded()
ParameterDescriptorTest.testIsCascadedForMethod()
ParameterDescriptorTest.testIsCascadedForConstructor()
b)

The method getGroupConversions returns a set with the group conversions declared for the cascadable element. An empty set will be returned if no group conversions are configured.

Coverage

No tests exist for this assertion

Section 6.5 - GroupConversionDescriptor

a)

The getFrom method returns the source of a group conversion rule.

Coverage

No tests exist for this assertion

b)

The getTo method returns the target of a group conversion rule.

Coverage

No tests exist for this assertion

Section 6.6 - PropertyDescriptor

a)

getPropertyName returns the property name as described in 5.2.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
PropertyDescriptorTest.testPropertyName()

Section 6.7 - ExecutableDescriptor, MethodDescriptor and ConstructorDescriptor

a)

getName() returns the name of the represented method (e.g. "placeOrder") respectively the non-qualified name of the declaring class of the represented constructor (e.g. "OrderService").

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ExecutableDescriptorTest.testGetNameForMethod()
ExecutableDescriptorTest.testGetNameForConstructor()
b)Needs update

getParameterDescriptors() returns a list of ParameterDescriptors representing the method's or constructor's parameters in order of their declaration, including synthetic parameters. An empty list will be returned in case the method or constructor has no parameters.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ExecutableDescriptorTest.testGetParameterDescriptorsForMethod()
ExecutableDescriptorTest.testGetParameterDescriptorsForParameterlessMethod()
ExecutableDescriptorTest.testGetParameterDescriptorsForConstructor()
ExecutableDescriptorTest.testGetParameterDescriptorsForConstructorOfInnerClass()
ExecutableDescriptorTest.testGetParameterDescriptorsForParameterlessConstructor()
c)

getReturnValueDescriptor() returns a descriptor for the method's or constructor's return value or null if it has no return value.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ExecutableDescriptorTest.testGetReturnValueDescriptorForMethod()
ExecutableDescriptorTest.testGetUnconstrainedReturnValueDescriptorForMethod()
ExecutableDescriptorTest.testReturnValueDescriptorForVoidMethod()
ExecutableDescriptorTest.testGetReturnValueDescriptorForConstructor()
ExecutableDescriptorTest.testGetUnconstrainedReturnValueDescriptorForConstructor()
d)

isConstrainedOnParameters() returns true if any of the parameters is constrained or cascaded or if the represented executable has at least one cross-parameter constraint. Returns false if there is no parameter.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ExecutableDescriptorTest.testAreParametersConstrainedForConstrainedMethod()
ExecutableDescriptorTest.testAreParametersConstrainedForCascadedMethod()
ExecutableDescriptorTest.testAreParametersConstrainedForCrossParameterConstrainedMethod()
ExecutableDescriptorTest.testAreParametersConstrainedForNotConstrainedMethod()
ExecutableDescriptorTest.testAreParametersConstrainedForParameterlessMethod()
ExecutableDescriptorTest.testAreParametersConstrainedForConstrainedConstructor()
ExecutableDescriptorTest.testAreParametersConstrainedForCascadedConstructor()
ExecutableDescriptorTest.testAreParametersConstrainedForCrossParameterConstrainedConstructor()
ExecutableDescriptorTest.testAreParametersConstrainedForNotConstrainedConstructor()
ExecutableDescriptorTest.testAreParametersConstrainedForParameterlessConstructor()
e)

isConstrainedOnReturnValue() returns true if the return value is constrained or cascaded. Returns false if there is no return value.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ExecutableDescriptorTest.testIsReturnValueConstrainedForConstrainedMethod()
ExecutableDescriptorTest.testIsReturnValueConstrainedForCascadedMethod()
ExecutableDescriptorTest.testIsReturnValueConstrainedForNotConstrainedMethod()
ExecutableDescriptorTest.testIsReturnValueConstrainedForVoidMethod()
ExecutableDescriptorTest.testIsReturnValueConstrainedForConstrainedConstructor()
ExecutableDescriptorTest.testIsReturnValueConstrainedForCascadedConstructor()
ExecutableDescriptorTest.testIsReturnValueConstrainedForNotConstrainedConstructor()
f)

The methods hasConstraints(), getConstraintDescriptors() and findConstraints() defined on ElementDescriptor are redefined to take cross-parameter constraints into account only. Constraint descriptors for individual parameters can be obtained from the corresponding ParameterMetaData object, while constraint descriptors for the return value can be obtained from ReturnValueDescriptor.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ExecutableDescriptorTest.testHasConstraintsForMethod()
ExecutableDescriptorTest.testHasConstraintsForConstructor()
ExecutableDescriptorTest.testGetConstraintsForMethod()
ExecutableDescriptorTest.testGetConstraintsForConstructor()
ExecutableDescriptorTest.testFindConstraintsForMethod()
ExecutableDescriptorTest.testFindConstraintsForMethodLookingAt()
ExecutableDescriptorTest.testFindConstraintsForMethodDefinedOnSuperTypeLookingAt()
ExecutableDescriptorTest.testFindConstraintsForConstructor()
g)

None of the metadata API methods honor the XML configuration <validated-executables/> nor the presence of @ValidateExecutable. In other words, all constrained methods and constructors will be returned by the metadata API regardless of these settings.

Coverage

No tests exist for this assertion

Section 6.8 - ParameterDescriptor

a)

getIndex() returns the index of the represented parameter within the parameter array of the method or constructor holding it.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ParameterDescriptorTest.testGetIndexForMethod()
ParameterDescriptorTest.testGetIndexForConstructor()
b)

getName() returns the name of the represented parameter.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ParameterDescriptorTest.testGetNameForMethod()
ParameterDescriptorTest.testGetNameForConstructor()

Section 6.10 - ConstraintDescriptor

a)

If ConstraintDescriptor represents a composing annotation (see 3.3), the returned annotation must reflect parameter overriding.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ConstraintDescriptorTest.testAnnotationAndMapParametersReflectParameterOverriding()
b)

getAttributes returns a map containing the annotation attribute names as a key, and the annotation attribute values as a value

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ConstraintDescriptorTest.testGetAttributesFromConstraintDescriptor()
c)

If ConstraintDescriptor represents a composing annotation (see 3.3), the returned Map must reflect attribute overriding.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ConstraintDescriptorTest.testAnnotationAndMapParametersReflectParameterOverriding()
d)

getGroups returns the groups the constraint is supposed to be applied upon.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ConstraintDescriptorTest.testGetGroups()
ConstraintDescriptorTest.testGetGroupsOnInterface()
ConstraintDescriptorTest.testGetGroupsWithImplicitGroup()
e)

If no group is set on the constraint declaration, the Default group is returned.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ConstraintDescriptorTest.testDefaultGroupIsReturnedIfNoGroupSpecifiedInDeclaration()
f)

The groups of a composing constraint are the groups of the composed constraint.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ConstraintDescriptorTest.testComposingConstraints()
g)

getPayload returns the payloads associated to the constraint or an empty set if none.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ConstraintDescriptorTest.testPayload()
h)

The payload from the main constraint annotation is inherited by the composing annotations.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ConstraintDescriptorTest.testComposingConstraintsPayload()
i)

Any payload definition on a composing annotation is ignored.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ConstraintDescriptorTest.testComposingConstraintsPayload()
j)

isReportAsSingleViolation returns true if the constraint is annotated with @ReportAsSingleViolation.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ConstraintDescriptorTest.testReportAsSingleViolation()
k)

getComposingConstraints return a set of composing ConstraintDescriptors where each descriptor describes a composing constraint.

Coverage

org.hibernate.beanvalidation.tck.tests.metadata
ConstraintDescriptorTest.testComposingConstraints()
ConstraintDescriptorTest.testEmptyComposingConstraints()

Section 7 - Built-in Constraint definitions

a)

Each Bean Validation provider must recognize built-in constraint annotations as valid constraint definitions and provide compliant constraint implementations for each.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testNullConstraint()
BuiltinConstraintsTest.testNotNullConstraint()
BuiltinConstraintsTest.testAssertTrueConstraint()
BuiltinConstraintsTest.testAssertFalseConstraint()
BuiltinConstraintsTest.testMinConstraint()
BuiltinConstraintsTest.testMaxConstraint()
BuiltinConstraintsTest.testDecimalMinConstraint()
BuiltinConstraintsTest.testDecimalMaxConstraint()
BuiltinConstraintsTest.testSizeConstraint()
BuiltinConstraintsTest.testDigitsConstraint()
BuiltinConstraintsTest.testPastConstraint()
BuiltinConstraintsTest.testFutureConstraint()
BuiltinConstraintsTest.testPatternConstraint()
b)

The built-in constraint validation implementation is having a lower priority than an XML mapping definition.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinValidatorOverrideTest.testXmlConfiguredValidatorConfigurationHasPrecedence()
c)

@Null constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testNullConstraint()
d)

@NotNull constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testNotNullConstraint()
e)

@AssertTrue constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testAssertTrueConstraint()
f)

@AssertFalse constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testAssertFalseConstraint()
g)

@Min constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testMinConstraint()
h)

@Max constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testMaxConstraint()
i)

@DecimalMin constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testDecimalMinConstraint()
j)

@DecimalMax constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testDecimalMaxConstraint()
k)

@Size constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testSizeConstraint()
l)

@Digits constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testDigitsConstraint()
m)

@Past constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testPastConstraint()
n)

@Future constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testFutureConstraint()
o)

@Pattern constraint

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.builtinconstraints
BuiltinConstraintsTest.testPatternConstraint()

Section 8 - XML deployment descriptor

a)

If an XML descriptor does not validate against the corresponding XSD file, a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
InvalidXmlConfigurationTest.testInvalidValidationXml()

Section 8.1 - Constraint definition and declaration

a)

Specifically when exploring metadata, the Bean Validation provider must ensure that an annotation instance corresponding to the XML declaration is provided via ConstraintDescriptor.getAnnnotation().

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
DuplicateConfigurationTest.testXmlConfiguredConstraintExposesCorrespondingAnnotationViaMetadata()
b)

A given class must not be described more than once amongst all the XML mapping descriptors.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
DuplicateConfigurationTest.testBeanCannotBeDescribedMoreThanOnce()
c)

A given field or getter must not be described more than once on a given class description.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
DuplicateConfigurationTest.testFieldMappingCannotOccurMoreThanOnce()
d)

A given constraint definition must not be overridden more than once amongst all the XML mapping descriptors.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
DuplicateConfigurationTest.testGetterMappingCannotOccurMoreThanOnce()
e)

If any of these rule is violated in a given validation deployment, a ValidationException is raised during the creation of the ValidatorFactory.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
DuplicateConfigurationTest.testBeanCannotBeDescribedMoreThanOnce()
DuplicateConfigurationTest.testFieldMappingCannotOccurMoreThanOnce()
DuplicateConfigurationTest.testGetterMappingCannotOccurMoreThanOnce()

Section 8.1.1 - Constraint declaration in XML

a)

If default-package is set, all unqualified class names (including annotations) are considered part of the package described by default-package.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
XmlConfigurationTest.testClassConstraintDefinedInXml()
XmlConfigurationTest.testIgnoreValidationXml()
XmlConfigurationTest.testPropertyConstraintDefinedInXml()
XmlConfigurationTest.testFieldConstraintDefinedInXml()
XmlConfigurationTest.testAnnotationDefinedConstraintApplies()
XmlConfigurationTest.testCascadingConfiguredInXml()
org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration
ConfigurationViaXmlAndAnnotationsTest.testEntityConfiguredViaAnnotationsAndXml()
b)

A given JavaBean is described by the bean element.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
XmlConfigurationTest.testClassConstraintDefinedInXml()
XmlConfigurationTest.testIgnoreValidationXml()
XmlConfigurationTest.testPropertyConstraintDefinedInXml()
XmlConfigurationTest.testFieldConstraintDefinedInXml()
XmlConfigurationTest.testAnnotationDefinedConstraintApplies()
XmlConfigurationTest.testCascadingConfiguredInXml()
c)

The name of the class is mandatory.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
MissingClassNameOnBeanNodeTest.testClassNameIsMandatory()
d)

By default, all constraint declarations expressed via annotation are ignored for classes described in XML.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration
ConstraintDeclarationTest.testConstraintAnnotationsArePerDefaultIgnoredForXmlConfiguredEntities()
e)

You can force Bean Validation to consider both annotations and XML constraint declarations by using ignore-annotation="false" on bean.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration
ConfigurationViaXmlAndAnnotationsTest.testEntityConfiguredViaAnnotationsAndXml()
f)

If the name of the class does refer to a class not present in in the classpath, a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration
ConfiguredBeanNotInClassPathTest.testExceptionIsThrownForUnknownBeanNameInXml()

Section 8.1.1.1 - Class-level overriding

a)

If ignore-annotations is declared, Bean Validation must honor the explicit value for this element.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel
ClassLevelOverridingTest.testIgnoreClassLevelAnnotations()
ClassLevelOverridingTest.testClassLevelAnnotationsApplied()
b)

If not declared, the default value defined in the encapsulating bean element is considered.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel
ClassLevelOverridingTest.testIgnoreAnnotationsFromEnclosingBeanIsApplied()
c)

When ignore-annotations is true, class-level Bean Validation annotations are ignored for this class (including the @GroupSequence).

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel
ClassLevelOverridingTest.testIgnoreClassLevelAnnotations()
d)

Constraints declared in XML and constraints declared in annotations are added and form the list of class-level declared constraints.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel
ClassLevelOverridingTest.testClassLevelAnnotationsApplied()
e)

@GroupSequence is considered unless group-sequence element is explicitly used.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration
ConfigurationViaXmlAndAnnotationsTest.testDefaultGroupDefinitionDefinedInEntityApplies()
DefaultSequenceDefinedInXmlTest.testDefaultGroupDefinitionDefinedInEntityApplies()

Section 8.1.1.2 - Field-level overriding

a)

If ignore-annotations is declared, Bean Validation must honor the explicit value for this element.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.fieldlevel
FieldLevelOverridingTest.testIgnoreAnnotations()
FieldLevelOverridingTest.testIncludeAnnotations()
b)

If not declared, the default value defined in the encapsulating bean element is considered.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.fieldlevel
ExcludeFieldLevelAnnotationsDueToBeanDefaultsTest.testIgnoreAnnotations()
IncludeFieldLevelAnnotationsDueToBeanDefaultsTest.testAnnotationsIncluded()
c)

When ignore-annotations is true, field-level Bean Validation annotations on the targeted field are ignored (including @Valid and @ConvertGroup).

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.fieldlevel
FieldLevelOverridingTest.testIgnoreAnnotations()
ExcludeFieldLevelAnnotationsDueToBeanDefaultsTest.testIgnoreAnnotations()
d)

Constraints declared in XML and constraints declared in annotations are added and form the list of field-level declared constraints.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.fieldlevel
FieldLevelOverridingTest.testIncludeAnnotations()
IncludeFieldLevelAnnotationsDueToBeanDefaultsTest.testAnnotationsIncluded()
e)

Note that the only way to disable cascading on a field marked as @Valid is to use ignore-annotations=true.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.fieldlevel
FieldLevelOverridingTest.testCascadedConfiguration()
f)

Group conversions declared in XML and via the @ConvertGroup annotation are added and form the list of applied conversions. Note that the rules for the declaration of group conversions as outlined in 4.4.5 apply, in particular it is not legal to declare several conversions for the same source group.

Coverage

No tests exist for this assertion

h)

If the name of the field does not correspond to a field in the given bean a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.fieldlevel
WrongFieldNameTest.testWrongFieldNameThrowsException()

Section 8.1.1.3 - Property-level overriding

a)

The name attribute corresponds to the name of the property considered as defined in 4.1.2 (for example a getter String getAge() would have <getter name="age"/> as a corresponding descriptor). If ignore-annotations is declared, Bean Validation must honor the explicit value for this element.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.propertylevel
PropertyLevelOverridingTest.testIgnoreAnnotations()
PropertyLevelOverridingTest.testIncludeAnnotations()
b)

If not declared, the default value defined in the encapsulating bean element is considered.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.propertylevel
IncludePropertyLevelAnnotationsDueToBeanDefaultsTest.testAnnotationsIncluded()
ExcludePropertyLevelAnnotationsDueToBeanDefaultsTest.testIgnoreAnnotations()
c)

When ignore-annotations is true, property-level Bean Validation annotations on the targeted property are ignored (including @Valid and @ConvertGroup).

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.propertylevel
PropertyLevelOverridingTest.testIgnoreAnnotations()
ExcludePropertyLevelAnnotationsDueToBeanDefaultsTest.testIgnoreAnnotations()
d)

Constraints declared in XML and constraints declared in annotations are added and form the list of property-level declared constraints.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.propertylevel
IncludePropertyLevelAnnotationsDueToBeanDefaultsTest.testAnnotationsIncluded()
PropertyLevelOverridingTest.testIncludeAnnotations()
e)

Note that the only way to disable cascading on a property marked as @Valid is to use ignore-annotations=true.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.propertylevel
PropertyLevelOverridingTest.testCascadedConfiguration()
f)

Group conversions declared in XML and via the @ConvertGroup annotation are added and form the list of applied conversions. Note that the rules for the declaration of group conversions as outlined in 4.4.5 apply, in particular it is not legal to declare several conversions for the same source group.

Coverage

No tests exist for this assertion

h)

If the name of the property does not correspond to a property in the given bean a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration.propertylevel
WrongPropertyNameTest.testWrongPropertyNameThrowsException()

Section 8.1.1.4 - Constructor-level overriding

a)

To identify a constructor to be configured, zero or more parameter elements are used, matching the number and types of parameters of the configured constructor. When configuring the default constructor, no parameter element is to be used. The parameter types are specified using their fully qualified name; If the default-package element is configured for the mapping file, any unqualified class names will be resolved using the given default package. Primitive types (int, long etc.) are referenced by specifying the corresponding keyword of the Java language.

Coverage

No tests exist for this assertion

b)

If no constructor with the specified parameter types exists in the given bean a ValidationException is raised.

Coverage

No tests exist for this assertion

c)

The optional return-value element is used to change the configuration of a constructor's return value if required.

Coverage

No tests exist for this assertion

d)

The constraints applying for a constructor's parameters and its return value are specified by adding constraint elements to the parameter and return-value elements respectively.

Coverage

No tests exist for this assertion

e)

Whether or not to perform cascaded validation is controlled using the valid element

Coverage

No tests exist for this assertion

f)

Group conversion rules for cascaded validation are specified using the convert-group element.

Coverage

No tests exist for this assertion

g)

By adding cross-parameter-constraint elements to the constructor element, cross-parameter constraints can be configured.

Coverage

No tests exist for this assertion

h)

If ignore-annotations is declared on the parameter or return value level, Bean Validation must honor the explicit value for this element. Otherwise, if ignore-annotations is declared for the constructor element, Bean Validation must honor this value. Otherwise, the default value declared in the encapsulating bean element is considered.

Coverage

No tests exist for this assertion

i)

When ignore-annotations is true, Bean Validation annotations on the targeted constructor or parameter are ignored (including @Valid and @ConvertGroup).

Coverage

No tests exist for this assertion

j)

Constraints declared in XML and constraints declared in annotations are added and form the list of declared parameter, cross-parameter or return value constraints respectively.

Coverage

No tests exist for this assertion

k)

@Valid is considered unless the valid element is explicitly used.

Coverage

No tests exist for this assertion

l)

Note that the only way to disable cascading on a constructor parameter or return value marked as @Valid is to use ignore-annotations=true.

Coverage

No tests exist for this assertion

m)

Group conversions declared in XML and via the @ConvertGroup annotation are added and form the list of applied conversions. Note that the rules for the declaration of group conversions as outlined in 4.4.5 apply, in particular it is not legal to declare several conversions for the same source group.

Coverage

No tests exist for this assertion

Section 8.1.1.5 - Method-level overriding

a)

To identify a method to be configured, its name and zero or more parameter elements are specified, matching the number and types of parameters of the configured method. The parameter types are specified using their fully qualified name; If the default-package element is configured for the mapping file, any unqualified class names will be resolved using the given default package. Primitive types (int, long etc.) are referenced by specifying the corresponding keyword of the Java language.

Coverage

No tests exist for this assertion

b)

A given getter method representing a JavaBeans property may either be configured using the getter or the method element, but not both. If a getter element and a method element referring to the same method are detected by the Bean Validation provider, a ValidationException is raised.

Coverage

No tests exist for this assertion

c)

If no method with the specified name and parameter types exists in the given bean a ValidationException is raised.

Coverage

No tests exist for this assertion

d)

The optional return-value element is used to change the configuration of a mehod's return value if required.

Coverage

No tests exist for this assertion

e)

The constraints applying for a method's parameters and its return value are specified by adding constraint elements to the parameter and return-value elements respectively.

Coverage

No tests exist for this assertion

f)

Whether or not to perform cascaded validation is controlled using the valid element.

Coverage

No tests exist for this assertion

g)

Group conversion rules for cascaded validation are specified using the convert-group element.

Coverage

No tests exist for this assertion

h)

By adding cross-parameter-constraint elements to the method element, cross-parameter constraints can be configured.

Coverage

No tests exist for this assertion

i)

If ignore-annotations is declared on the parameter or return value level, Bean Validation must honor the explicit value for this element. Otherwise, if ignore-annotations is declared for the method element, Bean Validation must honor this value. Otherwise, the default value declared in the encapsulating bean element is considered.

Coverage

No tests exist for this assertion

j)

When ignore-annotations is true, Bean Validation annotations on the targeted method or parameter are ignored (including @Valid and @ConvertGroup).

Coverage

No tests exist for this assertion

k)

Constraints declared in XML and constraints declared in annotations are added and form the list of declared parameter, cross-parameter or return value constraints respectively.

Coverage

No tests exist for this assertion

l)

@Valid is considered unless the valid element is explicitly used.

Coverage

No tests exist for this assertion

m)

Note that the only way to disable cascading on a method parameter or return value marked as @Valid is to use ignore-annotations=true.

Coverage

No tests exist for this assertion

n)

Group conversions declared in XML and via the @ConvertGroup annotation are added and form the list of applied conversions. Note that the rules for the declaration of group conversions as outlined in 4.4.5 apply, in particular it is not legal to declare several conversions for the same source group.

Coverage

No tests exist for this assertion

Section 8.1.1.6 - Constraint declaration

a)

The name attribute is mandatory and represents the name of the element in the constraint declaration.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration
MandatoryNameAttributeTest.testNameAttributeIsMandatory()
b)Needs update

Message, groups and payload are not permitted names, use the message, groups or payload elements instead. Otherwise a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration
ReservedElementNameTest.testGroupIsNotAllowedAsElementName()
ReservedElementNameTest.testMessageIsNotAllowedAsElementName()
c)

If the element represents a primitive type, a class or an enum, the string representation of its value is placed in the element itself.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
XmlConfigurationTest.testElementConversionInXmlConfiguredConstraint()
d)

If the element represents a primitive type array, a class array or an enum array, the string representation of each value is placed in a value element placed under the element itself.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
XmlConfigurationTest.testElementConversionInXmlConfiguredConstraint()
e)

If the element represents an annotation, the annotation element is used to represent the annotation and placed under element.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
XmlConfigurationTest.testElementConversionInXmlConfiguredConstraint()
f)

If the element represents an array of annotations, one or more annotation elements are placed under element.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
XmlConfigurationTest.testElementConversionInXmlConfiguredConstraint()
g)

Elements with default values in the annotation definition do not have to be represented in XML: the default value will be used in this case.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
XmlConfigurationTest.testElementConversionInXmlConfiguredConstraint()
h)

If an XML constraint declaration is missing mandatory elements, or if it contains elements not part of the constraint definition, a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdeclaration
MissingMandatoryElementTest.testMissingMandatoryElementInConstraintDeclaration()

Section 8.1.1.7 - Declaration of group conversions

a)

Group conversion rules are declared by specifying one ore more convert-group elements within the field, getter, parameter and return-value elements.

Coverage

No tests exist for this assertion

b)

Source and target group of a conversion rule are given by specifying there fully-qualified names within the from and to attribute respectively. If the default-package element is configured for the mapping file, any unqualified class names will be resolved using the given default package.

Coverage

No tests exist for this assertion

Section 8.1.2 - Overriding constraint definitions in XML

a)

A constraint definition is represented by a constraint-definition element.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration
XmlConfigurationTest.testClassConstraintDefinedInXml()
XmlConfigurationTest.testIgnoreValidationXml()
XmlConfigurationTest.testPropertyConstraintDefinedInXml()
XmlConfigurationTest.testFieldConstraintDefinedInXml()
XmlConfigurationTest.testAnnotationDefinedConstraintApplies()
XmlConfigurationTest.testCascadingConfiguredInXml()
b)

If include-existing-validator is set to false, ConstraintValidator defined on the constraint annotation are ignored.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdefinition
XmlConfiguredConstraintValidatorTest.testExcludeExistingValidators()
c)

If set to true, the list of ConstraintValidators described in XML are concatenated to the list of ConstraintValidator described on the annotation to form a new array of ConstraintValidator evaluated.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdefinition
XmlConfiguredConstraintValidatorTest.testIncludeExistingValidators()
d)

Annotation based ConstraintValidator come before XML based ConstraintValidators in the array.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdefinition
XmlConfiguredConstraintValidatorTest.testIncludeExistingValidators()
e)

The new validator list is returned by ConstraintDescriptor.getConstraintValidatorClasses().

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdefinition
XmlConfiguredConstraintValidatorTest.testExcludeExistingValidators()
XmlConfiguredConstraintValidatorTest.testIncludeExistingValidators()

Section 8.1.4 - XML Schema

a)

Implementations supporting Bean Validation 1.1 must properly parse mapping descriptors of Bean Validation 1.0 and 1.1.

Coverage

No tests exist for this assertion

b)

If the version attribute attribute is not given, schema version 1.0 is to be assumed by the Bean Validation Provider.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.versioning
VersionNotGivenTest.testValidationXmlWithoutSchemaVersionIsHandledAs10()
c)

In case an unknown version is given (e.g. if a mapping descriptor adhering to a future schema version is parsed by a Bean Validation 1.1 provider) a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.versioning
UnknownVersionTest.testValidationXmlWithUnknownSchemaVersion()

Section 8.2 - Configuration schema

a)

Implementations supporting Bean Validation 1.1 must properly parse configuration descriptors of Bean Validation 1.0 and 1.1.

Coverage

No tests exist for this assertion

b)

If the version attribute attribute is not given, schema version 1.0 is to be assumed by the Bean Validation Provider.

Coverage

No tests exist for this assertion

c)

In case an unknown version is given a ValidationException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.xmlconfiguration.versioning
MappingVersioningTest.testConstraintMappingWithUnknownSchemaVersion()

Section 9 - Exception model

a)

Every (runtime) exception raised either at initialization time or execution time by any of the extension interfaces (ConstraintValidator, ConstraintValidatorFactory, MessageInterpolator, TraversableResolver, ValidationProviderResolver) is wrapped in a ValidationException.

Coverage

org.hibernate.beanvalidation.tck.tests.bootstrap.customprovider
BootstrapNonAvailableValidationProviderTest.testUnknownProviderConfiguredInValidationXml()
BootstrapNonAvailableValidationProviderTest.testConfiguredValidationProviderIsNotLoadable()

Section 9.2 - Constraint definition: ConstraintDefinitionException

a)

If a constraint definition does not respect the Bean Validation rules or is inconsistent, a ConstraintDefinitionException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.invalidconstraintdefinitions
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithParameterStartingWithValid()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithoutMessageParameter()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithoutGroupParameter()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithoutPayloadParameter()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongDefaultGroupValue()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongDefaultPayloadValue()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongPayloadClass()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongMessageType()
InvalidConstraintDefinitionsTest.testConstraintDefinitionWithWrongGroupType()

Section 9.3 - Constraint declaration: ConstraintDeclarationException and UnexpectedTypeException

a)

When a constraint declaration is illegal, ConstraintDeclarationException is raised.

b)

When the return type of a property cannot be processed for a given constraint, an UnexpectedTypeException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.validatorresolution
ValidatorResolutionTest.testAmbiguousValidatorResolution()

Section 9.4 - Group definition: GroupDefinitionException

a)

When a group definition is illegal, GroupDefinitionException is raised.

Coverage

org.hibernate.beanvalidation.tck.tests.constraints.groups.groupsequence
SequenceResolutionTest.testInvalidDefinitionOfDefaultSequenceInEntity()
org.hibernate.beanvalidation.tck.tests.constraints.groups
GroupTest.testCyclicGroupSequence()

Section 10.1.2 - Method and constructor validation

a)

By default, method validation is applied to all constrained methods or constructors provided the integration technology can intercept the call. By default, getters (as defined in 4.1) are not considered constrained methods.

Coverage

No tests exist for this assertion

b)

If it is annotated with @ValidateExecutable and the type attribute contains the executable type. If the type attribute does not contain the executable type, the executable is not validated.

Coverage

No tests exist for this assertion

c)

Otherwise if the type (class, interface) on which the executable is defined is annotated with @ValidateExecutable and the type attribute contains the executable type. If the type attribute does not contain the executable type, the executable is not validated.

Coverage

No tests exist for this assertion

d)

Otherwise if the global configuration of validated executables contains the executable type. If the global setting does not contain the executable type, the executable is not validated.

Coverage

No tests exist for this assertion

e)

The rules above do not apply to methods overriding a superclass method or implementing an interface method. In this case, the method inherits the behavior of the method it overrides / implements.

Coverage

No tests exist for this assertion

f)

CONSTRUCTORS: parameters and return values are validated provided the executable is a constructor.

Coverage

No tests exist for this assertion

g)

NONGETTERMETHODS: parameters and return values are validated provided the executable is a method but not a getter.

Coverage

No tests exist for this assertion

h)

GETTER_METHODS: parameters and return values are validated provided the executable is a getter method.

Coverage

No tests exist for this assertion

i)

ALL: parameters and return values are validated for all executables (getters, non getters and constructors). This option is equivalent to a list of all executable types and is present to improve readability. A list containing ALL and other types of executables is equivalent to a list containing only ALL.

Coverage

No tests exist for this assertion

Section 10.3.2 - ConstraintValidatorFactory, MessageInterpolator, ParameterNameProvider and TraversableResolver

a)

Using directly or indirectly a JPA EntityManager that might call back Bean Validation for validation is not allowed in the Bean Validation extension points and in ConstraintValidator instances. This would lead to infinite flush or unexpected behavior.

Coverage

No tests exist for this assertion