FileSupport { public static File link(File sourceLocation, File targetLocation) throws IOException { return link(sourceLocation, targetLocation, false); } private  FileSupport(); static File copy(File sourceLocation, File targetLocation); static File copy(File sourceFile, File targetFile, boolean overwrite); static File link(File sourceLocation, File targetLocation); static File link(final File sourceLocation, final File targetLocation, final boolean overwrite); static boolean supportsLinking(File sourceLocation, File targetLocation); static boolean deleteHierarchyIfEmpty(File limit, File start); static boolean isEqual(File a, File b); static boolean isParent(File a, File b); static boolean delete(File f); static boolean deleteQuietly(File f); static boolean deleteQuietly(File f, boolean recurse); static boolean delete(File f, boolean recurse); static boolean delete(File dir, int mode); static void setTempDirectory(File tmpDir); static File getTempDirectory(); static File getTempDirectory(String subdir); static final int DELETE_FILES; static final int DELETE_ROOT; }
@Test public void linkTestWithoutForce() throws IOException { assertNotNull(FileSupport.link(fileToLink, linkLocation, false)); assertTrue(linkLocation.exists()); }
@Test public void linkTestWithForce() throws IOException { assertNotNull(FileSupport.link(fileToLink, linkLocation, true)); assertTrue(linkLocation.exists()); }
@Test(expected = IOException.class) public void missingLinkTestFailsWithoutForce() throws Exception { FileSupport.link(linkLocation, fileToLink, false); }
@Test(expected = IOException.class) public void missingLinkTestFailsWithForce() throws Exception { FileSupport.link(linkLocation, fileToLink, true); }