public Path getParent() {
        final String path = uri.getPath();
        final int lastSlash = path.lastIndexOf('/');
        final int start = hasWindowsDrive(path, true) ? 3 : 0;
        if ((path.length() == start)
                || // empty path
                (lastSlash == start && path.length() == start + 1)) { // at root
            return null;
        }
        String parent;
        if (lastSlash == -1) {
            parent = CUR_DIR;
        } else {
            final int end = hasWindowsDrive(path, true) ? 3 : 0;
            parent = path.substring(0, lastSlash == end ? end + 1 : lastSlash);
        }
        return new Path(uri.getScheme(), uri.getAuthority(), parent);
    }
@Test
    void testGetParent() {

        Path p = new Path("/my/fancy/path");
        assertThat(p.getParent().toUri().getPath()).isEqualTo("/my/fancy");

        p = new Path("/my/other/fancy/path/");
        assertThat(p.getParent().toUri().getPath()).isEqualTo("/my/other/fancy");

        p = new Path("hdfs:///my/path");
        assertThat(p.getParent().toUri().getPath()).isEqualTo("/my");

        p = new Path("hdfs:///myPath/");
        assertThat(p.getParent().toUri().getPath()).isEqualTo("/");

        p = new Path("/");
        assertThat(p.getParent()).isNull();

        p = new Path("C:/my/windows/path");
        assertThat(p.getParent().toUri().getPath()).isEqualTo("/C:/my/windows");
    }