@Override
  public GcsPath getFileName() {
    int nameCount = getNameCount();
    if (nameCount < 2) {
      throw new UnsupportedOperationException(
          "Can't get filename from root path in the bucket: " + this);
    }
    return getName(nameCount - 1);
  }
@Test
  public void testGetFileName() {
    assertEquals("foo", GcsPath.fromUri("gs://bucket/bar/foo").getFileName().toString());
    assertEquals("foo", GcsPath.fromUri("gs://bucket/foo").getFileName().toString());
    thrown.expect(UnsupportedOperationException.class);
    GcsPath.fromUri("gs://bucket/").getFileName();
  }