HadoopResourceId implements ResourceId { @Override public String getFilename() { if (isDirectory()) { Path parentPath = new Path(uri).getParent(); return parentPath == null ? null : parentPath.getName(); } return new Path(uri).getName(); } HadoopResourceId(URI uri); @Override ResourceId resolve(String other, ResolveOptions resolveOptions); @Override ResourceId getCurrentDirectory(); @Override boolean isDirectory(); @Override String getFilename(); @Override String getScheme(); @Override String toString(); @Override boolean equals(@Nullable Object obj); @Override int hashCode();  }
@Test public void testGetFilename() { assertNull(toResourceIdentifier("").getFilename()); assertEquals("abc", toResourceIdentifier("/dirA/abc").getFilename()); assertEquals("abc", toResourceIdentifier("/dirA/abc/").getFilename()); assertEquals("xyz.txt", toResourceIdentifier("/dirA/abc/xyz.txt").getFilename()); }