@Override
  public ParseResult parsePath(String path) {
    if (path.isEmpty()) {
      return emptyPath();
    }

    checkValid(path);

    String root = path.startsWith("/") ? "/" : null;
    return new ParseResult(root, splitter().split(path));
  }
@Test
  public void testUnix_illegalCharacters() {
    try {
      PathType.unix().parsePath("/foo/bar\0");
      fail();
    } catch (InvalidPathException expected) {
      assertEquals(8, expected.getIndex());
    }

    try {
      PathType.unix().parsePath("/\u00001/foo");
      fail();
    } catch (InvalidPathException expected) {
      assertEquals(1, expected.getIndex());
    }
  }