### Question:
PathService implements Comparator<JimfsPath> { public int hash(JimfsPath path) { int hash = 31; hash = 31 * hash + getFileSystem().hashCode(); final Name root = path.root(); final ImmutableList<Name> names = path.names(); if (equalityUsesCanonicalForm) { hash = 31 * hash + (root == null ? 0 : root.hashCode()); for (Name name : names) { hash = 31 * hash + name.hashCode(); } } else { hash = 31 * hash + (root == null ? 0 : root.toString().hashCode()); for (Name name : names) { hash = 31 * hash + name.toString().hashCode(); } } return hash; } PathService(Configuration config);   PathService(
      PathType type,
      Iterable<PathNormalization> displayNormalizations,
      Iterable<PathNormalization> canonicalNormalizations,
      boolean equalityUsesCanonicalForm); void setFileSystem(FileSystem fileSystem); FileSystem getFileSystem(); String getSeparator(); JimfsPath emptyPath(); Name name(String name); JimfsPath createRoot(Name root); JimfsPath createFileName(Name name); JimfsPath createRelativePath(Iterable<Name> names); JimfsPath createPath(@NullableDecl Name root, Iterable<Name> names); JimfsPath parsePath(String first, String... more); String toString(JimfsPath path); int hash(JimfsPath path); @Override int compare(JimfsPath a, JimfsPath b); URI toUri(URI fileSystemUri, JimfsPath path); JimfsPath fromUri(URI uri); PathMatcher createPathMatcher(String syntaxAndPattern);  }### Answer:
@Test public void testHash_usingDisplayForm() { PathService pathService = fakePathService(PathType.unix(), false); JimfsPath path1 = new JimfsPath(pathService, null, ImmutableList.of(Name.create("FOO", "foo"))); JimfsPath path2 = new JimfsPath(pathService, null, ImmutableList.of(Name.create("FOO", "FOO"))); JimfsPath path3 = new JimfsPath( pathService, null, ImmutableList.of(Name.create("FOO", "9874238974897189741"))); assertThat(pathService.hash(path1)).isEqualTo(pathService.hash(path2)); assertThat(pathService.hash(path2)).isEqualTo(pathService.hash(path3)); }
@Test public void testHash_usingCanonicalForm() { PathService pathService = fakePathService(PathType.unix(), true); JimfsPath path1 = new JimfsPath(pathService, null, ImmutableList.of(Name.create("foo", "foo"))); JimfsPath path2 = new JimfsPath(pathService, null, ImmutableList.of(Name.create("FOO", "foo"))); JimfsPath path3 = new JimfsPath( pathService, null, ImmutableList.of(Name.create("28937497189478912374897", "foo"))); assertThat(pathService.hash(path1)).isEqualTo(pathService.hash(path2)); assertThat(pathService.hash(path2)).isEqualTo(pathService.hash(path3)); }