FileUtil { public static File getRelativeFile(File subj, File relativeTo) { return new File(getRelativePath(subj, relativeTo)); }  static String getRelativePath(File subj, File relativeTo); static File getRelativeFile(File subj, File relativeTo); static String getFileExtension(String fileName); static boolean isLegalFileName(String fileName); static boolean isLegalFileNameChar(char c); static void copyFile(File source, File destination); static void createDirIfNotExists(File dir); static boolean deltree(File directory); static boolean deleteFiles(File directory); static boolean deleteChildren(File directory); static boolean moveRecursive(File from, File to, Collection<File> excludes); @Deprecated static synchronized File createTempDir(String prefix); static void deleteDir(File dir);  }
@Test public void getRelativePathWorksWithRootDirectory() { assertEquals(new File(""), FileUtil.getRelativeFile(new File("/"), new File("/"))); }