SymbolicLinkHelper implements ISystemFileCommandsHelper { public static boolean exists(String path) { if (nonNull(path)) { try { Path filePath = Paths.get(path); if (nonNull(filePath)) { return Files.exists(filePath, LinkOption.NOFOLLOW_LINKS); } } catch (Exception thr) { Log.error("Unexpected exception invoking method: %s", thr.getLocalizedMessage()); Log.exception(thr); } } return false; }  static boolean isSymbolicLinkCapable(); static boolean isSymbolicLink(String path); static String readSymbolicLink(String link); static long getLastModifiedTime(String link); static boolean exists(String path); static String move(String source, String target); static String createSymbolicLink(String link, String target);  }
@Test public void testExistsNull() throws IOException { assertFalse(SymbolicLinkHelper.exists(null)); }
@Test public void testExistsEmpty() throws IOException { assertTrue(SymbolicLinkHelper.exists("")); }
@Test public void testExistsInvalid() throws IOException { assertFalse(SymbolicLinkHelper.exists( RandomStringUtils.randomNumeric(10))); }
@Test public void testExists() throws IOException { Path tempLink = createTempLink(); assertTrue(SymbolicLinkHelper.exists(tempLink.toString())); tempFile.toFile().delete(); assertTrue(SymbolicLinkHelper.exists(tempLink.toString())); assertFalse(Files.exists(tempLink)); }