### Question:
RelativePathFunction implements Function<FileStatus, String> { @Override public String apply(@Nonnull FileStatus fileStatus) { return DistCpUtils.getRelativePath(sourceRootPath, fileStatus.getPath()); } RelativePathFunction(Path sourceRootPath); @Override String apply(@Nonnull FileStatus fileStatus);  }### Answer:
@Test public void typical() { Path sourceRootPath = new Path("/root/"); Path path = new Path("/root/foo/bar/"); when(fileStatus.getPath()).thenReturn(path); String relativePath = new RelativePathFunction(sourceRootPath).apply(fileStatus); assertThat(relativePath, is("/foo/bar")); }