FileUtils { public static boolean isSymbolicLink(File file) throws IOException { if (file == null || !file.exists()) return false; PrintStream printStream = new PrintStream(new ByteArrayOutputStream(), true, Charset.defaultCharset().name()); try { int result = Forker.forkProcess(printStream, file.getParentFile(), "test", "-L", file.getName()); return result == 0; } finally { IOUtils.closeQuietly(printStream); } }  static void mkdirs(final File f); static void deleteDirectory(final File directory); static String getDelta(File parent, File child); static String getRelativePath(String targetPath, String basePath, String pathSeparator); static boolean isSymbolicLink(File file); static void createSymbolicLink(final File source, final File target); static boolean isChild(File parent, File child); static String ensureLeadingSlash(final String path); static String getAppendix(final File f);  }
@Test public void testIsSymbolicLinkForNullFile() throws Exception { assertFalse(FileUtils.isSymbolicLink(null)); }
@Test public void testIsSymbolicLinkWithRealFile() throws Exception { File file = prepareFile(); assertFalse(FileUtils.isSymbolicLink(file)); }