@Nullable
    public static URI normalizeURI(@Nullable final URI uri, String scheme, int port, String path) {
        return Optional.ofNullable(uri)
                .map(u -> getUriWithScheme(u, scheme))
                .map(u -> getUriWithPort(u, port))
                .map(u -> getUriWithDefaultPath(u, path))
                .map(Tools::uriWithTrailingSlash)
                .map(URI::normalize)
                .orElse(null);
    }
@Test
    public void normalizeURIReturnsNullIfURIIsNull() {
        assertNull(Tools.normalizeURI(null, "http", 1234, "/baz"));
    }