use of org.hibernate.validator.constraintvalidators.RegexpURLValidator in project hibernate-validator by hibernate.
the class URLValidatorTest method setUp.
@BeforeMethod
public void setUp() {
descriptorBuilder = new ConstraintAnnotationDescriptor.Builder<URL>(URL.class);
urlValidator = new URLValidator();
regexpURLValidator = new RegexpURLValidator();
}
use of org.hibernate.validator.constraintvalidators.RegexpURLValidator in project hibernate-validator by hibernate.
the class URLValidatorTest method protocol_host_and_port_can_be_verified_explicitly.
@Test
public void protocol_host_and_port_can_be_verified_explicitly() {
descriptorBuilder.setAttribute("protocol", "http");
descriptorBuilder.setAttribute("host", "www.hibernate.org");
descriptorBuilder.setAttribute("port", 80);
URL url = descriptorBuilder.build().getAnnotation();
URLValidator validator = new URLValidator();
validator.initialize(url);
urlValidator.initialize(url);
assertProtocolHostAnsPortMatch(urlValidator);
regexpURLValidator.initialize(url);
assertProtocolHostAnsPortMatch(regexpURLValidator);
}
Aggregations