Path implements CacheValue, Comparable<Path> { @NotNull public StringBuilder toStringBuilder(@NotNull StringBuilder sb) { if (isRoot()) { sb.append('/'); } else { buildPath(sb); } return sb; } private  Path(@Nullable Path parent,
                 @NotNull String name,
                 int hash);  Path(@NotNull Path parent, @NotNull String name);  Path(@NotNull String name); @NotNull String getName(); @NotNull Iterable<String> elements(); boolean isRoot(); @Nullable Path getParent(); int length(); int getDepth(); @NotNull Path getAncestor(int nth); boolean isAncestorOf(@NotNull Path other); boolean isAbsolute(); @NotNull static Path fromString(@NotNull String path); @NotNull StringBuilder toStringBuilder(@NotNull StringBuilder sb); @Override int getMemory(); @Override int compareTo(@NotNull Path other); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static final Path ROOT; }
@Test public void toStringBuilder() { StringBuilder sb = new StringBuilder(); root.toStringBuilder(sb); assertEquals(root.toString(), sb.toString()); sb.setLength(0); foo.toStringBuilder(sb); assertEquals(foo.toString(), sb.toString()); sb.setLength(0); fooBar.toStringBuilder(sb); assertEquals(fooBar.toString(), sb.toString()); sb.setLength(0); fooBarQuux.toStringBuilder(sb); assertEquals(fooBarQuux.toString(), sb.toString()); sb.setLength(0); relFoo.toStringBuilder(sb); assertEquals(relFoo.toString(), sb.toString()); sb.setLength(0); relFooBar.toStringBuilder(sb); assertEquals(relFooBar.toString(), sb.toString()); sb.setLength(0); relFooBarQuux.toStringBuilder(sb); assertEquals(relFooBarQuux.toString(), sb.toString()); }