public Path makeQualified(FileSystem fs) {
        Path path = this;
        if (!isAbsolute()) {
            path = new Path(fs.getWorkingDirectory(), this);
        }

        final URI pathUri = path.toUri();
        final URI fsUri = fs.getUri();

        String scheme = pathUri.getScheme();
        String authority = pathUri.getAuthority();

        if (scheme != null && (authority != null || fsUri.getAuthority() == null)) {
            return path;
        }

        if (scheme == null) {
            scheme = fsUri.getScheme();
        }

        if (authority == null) {
            authority = fsUri.getAuthority();
            if (authority == null) {
                authority = "";
            }
        }

        return new Path(scheme + ":" + "//" + authority + pathUri.getPath());
    }
@Test
    void testMakeQualified() throws IOException {
        // make relative path qualified
        String path = "test/test";
        Path p = new Path(path).makeQualified(FileSystem.getLocalFileSystem());
        URI u = p.toUri();

        assertThat(u.getScheme()).isEqualTo("file");
        assertThat(u.getAuthority()).isNull();

        String q =
                new Path(FileSystem.getLocalFileSystem().getWorkingDirectory().getPath(), path)
                        .getPath();
        assertThat(u.getPath()).isEqualTo(q);

        // make absolute path qualified
        path = "/test/test";
        p = new Path(path).makeQualified(FileSystem.getLocalFileSystem());
        u = p.toUri();
        assertThat(u.getScheme()).isEqualTo("file");
        assertThat(u.getAuthority()).isNull();
        assertThat(u.getPath()).isEqualTo(path);
    }