@Override
  public GcsResourceId getCurrentDirectory() {
    if (isDirectory()) {
      return this;
    } else {
      GcsPath parent = gcsPath.getParent();
      checkState(
          parent != null,
          String.format("Failed to get the current directory for path: [%s].", gcsPath));
      return fromGcsPath(parent);
    }
  }
@Test
  public void testGetCurrentDirectory() {
    // Tests gcs paths.
    assertEquals(
        toResourceIdentifier("gs://my_bucket/tmp dir/"),
        toResourceIdentifier("gs://my_bucket/tmp dir/").getCurrentDirectory());

    // Tests path with unicode.
    assertEquals(
        toResourceIdentifier("gs://my_bucket/输出 目录/"),
        toResourceIdentifier("gs://my_bucket/输出 目录/文件01.txt").getCurrentDirectory());

    // Tests bucket with no ending '/'.
    assertEquals(
        toResourceIdentifier("gs://my_bucket/"),
        toResourceIdentifier("gs://my_bucket").getCurrentDirectory());
  }