URIV4FormatValidator implements FormatValidator { @Override public Optional<String> validate(final String subject) { try { new URI(subject); return Optional.empty(); } catch (URISyntaxException | NullPointerException e) { return failure(subject); } }  @Override Optional<String> validate(final String subject); @Override String formatName();  }
@Test public void relativeURI() { assertFalse(new URIV4FormatValidator().validate("abc").isPresent()); }
@Test public void absoluteURI() { assertFalse(new URIV4FormatValidator().validate("http: }
@Test public void notURI() { assertTrue(new URIV4FormatValidator().validate("\\\\\\\\WINDOWS\\\\fileshare").isPresent()); }