### Question:
FileManager { public void delete(File object) throws ApplicationException { delete(object, null); } FileManager();  FileManager(Application app); void synchronize(File source, File target); void rename(File fileToRename, File target); void move(File object, File newParent); void move(File object, File newParent, FileFilter filter); void delete(File object); void delete(File object, FileFilter filter); void deleteChildren(File parentDir); void deleteRecursively(File file); void deleteRecursively(File file, FileFilter filter,
                                DeletionPolicy deletePolicy); File copy(File objectFile, File destDir); File copy(File objectFile, File destDir, boolean overwrite); void copyRecursively(File objectFile, File destDir); void copyRecursively(File objectFile, File destDir, FileFilter filter); void copyRecursively(File objectFile, File destDir,
                              FileFilter filter, boolean overwrite); boolean filesDiffer(File f1, File f2);  }### Answer:
@Test(enabled = false) public void testRenameFileExistentTarget() throws Exception { File src = File.createTempFile("src", null); File target = File.createTempFile("target", null); try { StaticUtils.renameFile(src, target); assertFalse(src.exists()); assertTrue(target.exists()); } finally { src.delete(); target.delete(); } }
@Test(enabled = false, groups={"windows"}, expectedExceptions=IOException.class) public void testRenameFileLockedTarget() throws Exception { File src = File.createTempFile("src", null); File target = File.createTempFile("target", null); FileChannel c = new RandomAccessFile(target, "rw").getChannel(); FileLock lock = c.lock(); try { StaticUtils.renameFile(src, target); } finally { lock.release(); src.delete(); target.delete(); } }
@Test(enabled = false) public void testDelete() throws Exception { File dir = new File(fmWorkspace, "dir"); dir.mkdir(); assertTrue(dir.exists()); fileManager.delete(dir); assertFalse(dir.exists()); File file = new File(fmWorkspace, "file"); writeContents(file, "abc"); assertTrue(file.exists()); fileManager.delete(file); assertFalse(file.exists()); }
@Test(enabled = false) public void testDelete2() throws Exception { FileFilter filter = new FileFilter() { @Override public boolean accept(File pathname) { return false; } }; File dir = new File(fmWorkspace, "dir"); dir.mkdir(); assertTrue(dir.exists()); fileManager.delete(dir, filter); assertTrue(dir.exists()); File file = new File(fmWorkspace, "file"); writeContents(file, "abc"); assertTrue(file.exists()); fileManager.delete(file, filter); assertTrue(file.exists()); }