LdapUrlValidator implements ConstraintValidator<LdapUrlFormat, String> { @Override public boolean isValid(String str, ConstraintValidatorContext constraintValidatorContext) { return StringUtil.isNullOrWhitespace(str) || pattern.matcher(str).matches(); }  @Override void initialize(LdapUrlFormat ldapUrlFormat); @Override boolean isValid(String str, ConstraintValidatorContext constraintValidatorContext);  }
@Test(dataProvider = "TestLdapUrlValidator.Default") public void testIsValid(boolean valid, String url) { LdapUrlValidator validator = new LdapUrlValidator(); Assert.assertEquals(validator.isValid(url, null), valid); }