### Question:
FileUtils { public static String getFirstDirectory(String fileIdentifier) { fileIdentifier = StringUtils.stripEnd(fileIdentifier, File.separator); if (new File(fileIdentifier).isDirectory()) { return fileIdentifier; } return backOneDirectory(fileIdentifier); } private  FileUtils(); static String backOneDirectory(String fileIdentifier); static boolean copyRecursively(final File source, final File destination,
      final boolean deleteDestinationOnExit); static String ensureTrailingSeparator(final String path); static String getCanonicalPath(final File file); static String getFileSeparatorAsRegex(); static String getFirstDirectory(String fileIdentifier); static InputStream getInputStream(final Class<?> loadingClass, final String filename); static String getPath(final Class<?> loadingClass, final String relativeFilename); static String getSystemDependentPath(final Collection<String> pathElements); static String getSystemDependentPath(final String... pathElements); static boolean matchesAntPath(final String antPattern, final String canonicalPath); static final String CURRENT_DIRECTORY; }### Answer:
@Test public void testGetFirstDirectoryOfExistingDirectory() throws Exception { final URL url = Loader.class.getResource(TEST_FILE); final File file = org.apache.commons.io.FileUtils.toFile(url); final String directory = file.getParent(); final String firstDirectory = FileUtils.getFirstDirectory(directory); assertTrue(firstDirectory.endsWith("sub")); }