public static Validator validUrl() {
    return (name, val) -> {
      if (!(val instanceof String)) {
        throw new IllegalArgumentException("validator should only be used with STRING defs");
      }
      try {
        new URL((String)val);
      } catch (final Exception e) {
        throw new ConfigException(name, val, "Not valid URL: " + e.getMessage());
      }
    };
  }
@Test
  public void shouldNotThrowOnValidURL() {
    // Given:
    final Validator validator = ConfigValidators.validUrl();

    // When:
    validator.ensureValid("propName", "http://valid:25896/somePath");

    // Then: did not throw.
  }