// now the same test with programmatic configuration
HibernateValidatorConfiguration config = ValidatorUtil.getConfiguration( HibernateValidator.class );
ConstraintMapping mapping = config.createConstraintMapping();
mapping.type( URLContainer.class )
.property( "url", METHOD )
.constraint( new URLDef().regexp( "^http://\\S+[\\.htm|\\.html]{1}$" ) );
config.addMapping( mapping );
Validator validator = config.buildValidatorFactory().getValidator();
URLContainer container = new URLContainerNoAnnotations();
runUrlContainerValidation( validator, container, true );