public void testProgrammaticConstraint() {
final HibernateValidatorConfiguration config = getConfiguration( HibernateValidator.class );
ConstraintMapping mapping = config.createConstraintMapping();
mapping.type( Product.class )
.property( "ean", FIELD )
.constraint( new EANDef().type( EAN.Type.EAN13 ) );
config.addMapping( mapping );
Validator validator = config.buildValidatorFactory().getValidator();
Product product = new Product( "1234567891011" );
Set<ConstraintViolation<Product>> constraintViolations = validator.validate( product );