### Question:
IOUtilities extends Static { public static Path commonParent(Path root, final Path file) { while (root != null) { root = root.normalize(); if (file != null) { final Path nfile = file.normalize(); for (Path candidate = nfile; candidate != null; candidate = candidate.getParent()) { if (root.equals(candidate)) { return root; } } root = root.getParent(); } } return null; } private  IOUtilities(); static void deleteOnExit(Path path); static synchronized Writer standardWriter(); static synchronized PrintWriter standardPrintWriter(); static Path commonParent(Path root, final Path file); static Object tryToFile(Object path); static Object tryToPath(Object path); static Path toPath(Object candidate); static boolean canProcessAsPath(final Object path); static boolean isFileSystemSupported(final Object path); static String filename(Object input); static String extension(Object input); static String filenameWithoutExtension(Object path); static String filenameWithoutExtension(Path path); static Object changeExtension(final Object path, final String extension); static Path changeExtension(final Path path, final String extension); static InputStream open(Object resource); static InputStream open(Object resource, OpenOption... options); static LineNumberReader openLatin(final Object path); static OutputStream openWrite(Object resource); static OutputStream openWrite(Object resource, OpenOption... options); static void close(final Object stream); static void readMatrixRow(final BufferedReader in, final double[] grid,
            final int offset, final int numCol); static void readMatrixRow(final BufferedReader in, final float[] grid,
            final int offset, final int numCol); static void copy(final InputStream input, final OutputStream output); static void copy(Path sourcePath, Path targetPath, CopyOption... copyOption); static void deleteRecursively(final Path root); static boolean deleteSilently(Path path); static void appendToFile(final String text, final Path filePath); static void emptyFile(final Path filePath); static List<Path> listChildren(Path directory); static List<Path> listChildren(Path directory, String glob); static String toString(final Path filePath); static String toString(final Path filePath, final Charset encoding); static String toString(final InputStream stream); static String toString(final InputStream stream, final Charset encoding); static void writeString(final String content, final Path outputPath); static void writeString(final String content, final Path outputPath, final Charset encoding); static void writeStream(final InputStream stream, final Path outputPath); static Properties getPropertiesFromFile(final Path path); static void storeProperties(final Properties prop, final Path path, String comment); static Path getResourceAsPath(String resource); static Path getResourceAsPath(String resource, ClassLoader classLoader); static Path copyResource(String resource, ClassLoader classLoader, Path output, boolean createResourceHierarchy); static final Charset UTF8_CHARSET; }### Answer:
@Test public void testCommonParent() { final File root = new File("/home/root/subdirectory"); final File other = new File("/home/root/data/other"); assertEquals(new File("/home/root").toPath(), IOUtilities.commonParent(root.toPath(), other.toPath())); }