public static void checkURIIfPresent(@Nullable String uri,
                                         @Nonnull Predicate<URI> predicate) throws IllegalArgumentException {
        checkURIIfPresent(uri, predicate, null);
    }
@Test
    public void testCheckURIIfPresent() {
        checkURIIfPresent(null, uri -> false);
        checkURIIfPresent("", uri -> false);
        checkURIIfPresent("http://pulsar.apache.org", uri -> true);
        try {
            checkURIIfPresent("http/pulsar.apache.org", uri -> uri.getScheme() != null, "Error");
            Assert.fail("Unexpected behaviour");
        } catch (IllegalArgumentException ex) {
            // Ok
        }
    }