public Path path() {
        return path;
    }
@Test
    void testPath() {
        Path path = Path.parse("foo/bar/baz", Name::of);
        List<String> expected = List.of("foo", "bar", "baz");
        assertEquals(expected, path.segments());

        assertEquals(expected.subList(1, 3), path.skip(1).segments());
        assertEquals(expected.subList(0, 2), path.cut(1).segments());
        assertEquals(expected.subList(1, 2), path.skip(1).cut(1).segments());

        assertEquals("path '/foo/bar/baz/'", path.withTrailingSlash().toString());
        assertEquals(path, path.withoutTrailingSlash().withoutTrailingSlash());

        assertEquals(List.of("one", "foo", "bar", "baz", "two"),
                     Path.empty().append(List.of("one")).append(path).append("two").segments());

        assertEquals(List.of(expected.get(2), expected.get(0)),
                     path.append(path).cut(2).skip(2).segments());

        for (int i = 0; i < 3; i++) {
            assertEquals(path.head(i), path.cut(3 - i));
            assertEquals(path.tail(i), path.skip(3 - i));
        }

        assertThrows(NullPointerException.class,
                     () -> path.append((String) null));

        List<String> names = new ArrayList<>();
        names.add(null);
        assertThrows(NullPointerException.class,
                     () -> path.append(names));

        assertEquals("name must match '[A-Za-z][A-Za-z0-9_-]{0,63}', but got: '???'",
                     assertThrows(IllegalArgumentException.class,
                                  () -> path.append("???")).getMessage());

        assertEquals("skip count must be at least '0' and at most '1', but got: '2'",
                     assertThrows(IllegalArgumentException.class,
                                  () -> path.cut(2).skip(2)).getMessage());

        assertEquals("path segment decoded cannot contain '/', but got: '/'",
                     assertThrows(IllegalArgumentException.class,
                                  () -> Path.empty().append("%2525252525252525%2525252525253%25252532%252525%252534%36")).getMessage());

        assertEquals("path segment decoded cannot contain '?', but got: '?'",
                     assertThrows(IllegalArgumentException.class,
                                  () -> Path.empty().append("?")).getMessage());

        assertEquals("path segment decoded cannot contain '#', but got: '#'",
                     assertThrows(IllegalArgumentException.class,
                                  () -> Path.empty().append("#")).getMessage());

        assertEquals("path segments cannot be \"\", \".\", or \"..\", but got: '..'",
                     assertThrows(IllegalArgumentException.class,
                                  () -> Path.empty().append("%2E%25252E")).getMessage());

        assertEquals("path segments cannot be \"\", \".\", or \"..\", but got: ''",
                     assertThrows(IllegalArgumentException.class,
                                  () -> Path.parse("//")).getMessage());
    }