### Question:
Directory implements Serializable { public boolean isParentOf(final File file) { final File thisFile = getFile(); File candidate = file.getParentFile(); while (candidate != null) { if (thisFile.equals(candidate)) { return true; } candidate = candidate.getParentFile(); } return false; } Directory();  Directory(final File directory); static FileFilter getMatchAllFilesFilter(); void create(); File getFile(); File getFile(final File child); File[] listContents(final FileFilter filter); File[] listContents(final FileFilter filter,
                             final boolean includeDirectories,
                             final boolean absolutePaths); void deleteContents(); void delete(); File rebaseFromCWD(final File file); File relativeFile(final File file, final boolean mustBeChild); List<File> rebasePath(final String path); boolean isParentOf(final File file); void copyTo(final Directory target, final boolean incremental); String[] getWarnings(); @Override int hashCode(); @Override boolean equals(final Object o);  }### Answer:
@Test public void testIsParentOf() throws Exception { final File f1 = new File("xfoo"); final File f2 = new File("xfoo/bah"); final File f3 = new File("xfoo/bah/blah"); final File f4 = new File("xfoo/bah/dah"); assertTrue(new Directory(f1).isParentOf(f2)); assertTrue(new Directory(f1).isParentOf(f3)); assertFalse(new Directory(f2).isParentOf(f2)); assertFalse(new Directory(f2).isParentOf(f1)); assertFalse(new Directory(f3).isParentOf(f1)); assertFalse(new Directory(f3).isParentOf(f4)); }