public String relativize(GcsUri subPath) {
    Path relativePath = _absolutePath.get().relativize(subPath._absolutePath.get());
    checkState(!relativePath.isAbsolute() && !relativePath.startsWith(".."), "Path '%s' is not a subdirectory of '%s'",
        _absolutePath.get(), subPath._absolutePath.get());
    return relativePath.toString();
  }
@Test
  public void testRelativize() {
    GcsUri gcsUri = new GcsUri(URI.create("gs://bucket_name/dir"));
    GcsUri subDir = new GcsUri(URI.create("gs://bucket_name/dir/subdir/file"));
    assertEquals(gcsUri.relativize(subDir), "subdir/file");

    GcsUri nonRelativeGcsUri = new GcsUri(URI.create("gs://bucket_name/other/subdir/file"));
    assertThrows(IllegalStateException.class, () -> gcsUri.relativize(nonRelativeGcsUri));
  }