FileToRelativePath implements Function<File, String> { @Override public String apply(File f) { return this.workingDir.toURI().relativize(f.toURI()).toString(); } FileToRelativePath(File workingDir); @Override String apply(File f);  }
@Test @DataProvider({ "test", "1/2/3/xyz.txt" }) public void testApply(String path) throws IOException { File base = this.tempFolder.newFolder(); Assert.assertEquals(path, new FileToRelativePath(base).apply(new File(base, path))); }