@Test public void shouldValidateUrlString() throws Exception { TestDatum datum = new TestDatum(url); underTest.initialize(getUrlStringAnnotation(datum)); assertThat( String.format("'%s' should be %s", url, valid ? "valid" : "invalid"), underTest.isValid(datum.getUrl(), null), is(valid)); }
@Override public boolean isValid(final String url, final ConstraintValidatorContext constraintValidatorContext) { if (Strings2.isBlank(url)) { return true; } try { URI uri = new URI(url); return urlValidator.isValid(uri, constraintValidatorContext); } catch (URISyntaxException ignored) { return false; } }
UrlStringValidator extends ConstraintValidatorSupport<UrlString, String> { @Override public boolean isValid(final String url, final ConstraintValidatorContext constraintValidatorContext) { if (Strings2.isBlank(url)) { return true; } try { URI uri = new URI(url); return urlValidator.isValid(uri, constraintValidatorContext); } catch (URISyntaxException ignored) { return false; } } }
UrlStringValidator extends ConstraintValidatorSupport<UrlString, String> { @Override public boolean isValid(final String url, final ConstraintValidatorContext constraintValidatorContext) { if (Strings2.isBlank(url)) { return true; } try { URI uri = new URI(url); return urlValidator.isValid(uri, constraintValidatorContext); } catch (URISyntaxException ignored) { return false; } }  }
UrlStringValidator extends ConstraintValidatorSupport<UrlString, String> { @Override public boolean isValid(final String url, final ConstraintValidatorContext constraintValidatorContext) { if (Strings2.isBlank(url)) { return true; } try { URI uri = new URI(url); return urlValidator.isValid(uri, constraintValidatorContext); } catch (URISyntaxException ignored) { return false; } }  @Override boolean isValid(final String url, final ConstraintValidatorContext constraintValidatorContext); }
UrlStringValidator extends ConstraintValidatorSupport<UrlString, String> { @Override public boolean isValid(final String url, final ConstraintValidatorContext constraintValidatorContext) { if (Strings2.isBlank(url)) { return true; } try { URI uri = new URI(url); return urlValidator.isValid(uri, constraintValidatorContext); } catch (URISyntaxException ignored) { return false; } }  @Override boolean isValid(final String url, final ConstraintValidatorContext constraintValidatorContext);  }