public static void checkURI(@Nonnull String uri,
                                @Nonnull Predicate<URI> predicate) throws IllegalArgumentException {
        checkURI(uri, predicate, null);
    }
@Test
    public void testCheckURI() {
        // normal
        checkURI("http://pulsar.apache.org", uri -> true);
        checkURI("http://pulsar.apache.org", uri -> Objects.equals(uri.getScheme(), "http"));
        checkURI("", uri -> true);
        // illegal
        try {
            checkURI("pulsar.apache.org", uri -> Objects.equals(uri.getScheme(), "http"));
            Assert.fail("Unexpected behaviour");
        } catch (IllegalArgumentException ex) {
            // Ok
        }
        try {
            checkURI("pulsar.apache.org", uri -> Objects.equals(uri.getScheme(), "http"), "oops");
            Assert.fail("Unexpected behaviour");
        } catch (IllegalArgumentException ex) {
            Assert.assertEquals(ex.getMessage(), "oops");
        }
    }