@Test public void testValidUrl() throws UnknownHostException { Assert.assertTrue(validator.isValid("http: }
@Override public boolean isValid(String value, ConstraintValidatorContext context) { if (value == null) { return false; } if (!urlValidator.isValid(value)) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate(String.format("%s is invalid URL Address", value)) .addConstraintViolation(); return false; } return true; }
UrlValidator implements ConstraintValidator<Url, String> { @Override public boolean isValid(String value, ConstraintValidatorContext context) { if (value == null) { return false; } if (!urlValidator.isValid(value)) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate(String.format("%s is invalid URL Address", value)) .addConstraintViolation(); return false; } return true; } }
UrlValidator implements ConstraintValidator<Url, String> { @Override public boolean isValid(String value, ConstraintValidatorContext context) { if (value == null) { return false; } if (!urlValidator.isValid(value)) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate(String.format("%s is invalid URL Address", value)) .addConstraintViolation(); return false; } return true; } @Inject  UrlValidator(); }
UrlValidator implements ConstraintValidator<Url, String> { @Override public boolean isValid(String value, ConstraintValidatorContext context) { if (value == null) { return false; } if (!urlValidator.isValid(value)) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate(String.format("%s is invalid URL Address", value)) .addConstraintViolation(); return false; } return true; } @Inject  UrlValidator(); @Override void initialize(Url constraintAnnotation); @Override boolean isValid(String value, ConstraintValidatorContext context); }
UrlValidator implements ConstraintValidator<Url, String> { @Override public boolean isValid(String value, ConstraintValidatorContext context) { if (value == null) { return false; } if (!urlValidator.isValid(value)) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate(String.format("%s is invalid URL Address", value)) .addConstraintViolation(); return false; } return true; } @Inject  UrlValidator(); @Override void initialize(Url constraintAnnotation); @Override boolean isValid(String value, ConstraintValidatorContext context);  }