public int depth() {
        String path = uri.getPath();
        int depth = 0;
        int slash = path.length() == 1 && path.charAt(0) == '/' ? -1 : 0;
        while (slash != -1) {
            depth++;
            slash = path.indexOf(SEPARATOR, slash + 1);
        }
        return depth;
    }
@Test
    void testDepth() {

        Path p = new Path("/my/path");
        assertThat(p.depth()).isEqualTo(2);

        p = new Path("/my/fancy/path/");
        assertThat(p.depth()).isEqualTo(3);

        p = new Path("/my/fancy/fancy/fancy/fancy/fancy/fancy/fancy/fancy/fancy/fancy/path");
        assertThat(p.depth()).isEqualTo(12);

        p = new Path("/");
        assertThat(p.depth()).isZero();

        p = new Path("C:/my/windows/path");
        assertThat(p.depth()).isEqualTo(4);
    }