GcsPath implements Path, Serializable { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } GcsPath paths = (GcsPath) o; return bucket.equals(paths.bucket) && object.equals(paths.object); } GcsPath(@Nullable FileSystem fs, @Nullable String bucket, @Nullable String object); static GcsPath fromUri(URI uri); static GcsPath fromUri(String uri); static GcsPath fromResourceName(String name); static GcsPath fromObject(StorageObject object); static GcsPath fromComponents(@Nullable String bucket, @Nullable String object); String getBucket(); String getObject(); void setFileSystem(FileSystem fs); @Override FileSystem getFileSystem(); @Override boolean isAbsolute(); @Override GcsPath getRoot(); @Override GcsPath getFileName(); @Override GcsPath getParent(); @Override int getNameCount(); @Override GcsPath getName(int count); @Override GcsPath subpath(int beginIndex, int endIndex); @Override boolean startsWith(Path other); @Override boolean startsWith(String prefix); @Override boolean endsWith(Path other); @Override boolean endsWith(String suffix); @Override GcsPath normalize(); @Override GcsPath resolve(Path other); @Override GcsPath resolve(String other); @Override Path resolveSibling(Path other); @Override Path resolveSibling(String other); @Override Path relativize(Path other); @Override GcsPath toAbsolutePath(); @Override GcsPath toRealPath(LinkOption... options); @Override File toFile(); @Override WatchKey register(
      WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers); @Override WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events); @Override Iterator<Path> iterator(); @Override int compareTo(Path other); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override String toString(); String toResourceName(); @Override URI toUri(); static final String SCHEME; static final Pattern GCS_URI; }
@Test public void testEquals() { GcsPath a = GcsPath.fromComponents(null, "a/b/c"); GcsPath a2 = GcsPath.fromComponents(null, "a/b/c"); assertFalse(a.isAbsolute()); assertFalse(a2.isAbsolute()); GcsPath b = GcsPath.fromComponents("bucket", "a/b/c"); GcsPath b2 = GcsPath.fromComponents("bucket", "a/b/c"); assertTrue(b.isAbsolute()); assertTrue(b2.isAbsolute()); assertEquals(a, a); assertThat(a, Matchers.not(Matchers.equalTo(b))); assertThat(b, Matchers.not(Matchers.equalTo(a))); assertEquals(a, a2); assertEquals(a2, a); assertEquals(b, b2); assertEquals(b2, b); assertThat(a, Matchers.not(Matchers.equalTo(Paths.get("/tmp/foo")))); assertNotNull(a); }