* Tests deletion
*/
public void testDelete() throws Exception
{
// Set-up the test structure
FileObject folder = createScratchFolder();
folder.resolveFile("file1.txt").createFile();
folder.resolveFile("file%25.txt").createFile();
folder.resolveFile("emptydir").createFolder();
folder.resolveFile("dir1/file1.txt").createFile();
folder.resolveFile("dir1/dir2/file2.txt").createFile();
// Delete a file
FileObject file = folder.resolveFile("file1.txt");
assertTrue(file.exists());
file.delete(Selectors.SELECT_ALL);
assertTrue(!file.exists());
// Delete a special name file
file = folder.resolveFile("file%25.txt");
assertTrue(file.exists());
file.delete(Selectors.SELECT_ALL);
assertTrue(!file.exists());
// Delete an empty folder
file = folder.resolveFile("emptydir");
assertTrue(file.exists());
file.delete(Selectors.SELECT_ALL);
assertTrue(!file.exists());
// Recursive delete
file = folder.resolveFile("dir1");
FileObject file2 = file.resolveFile("dir2/file2.txt");
assertTrue(file.exists());
assertTrue(file2.exists());
file.delete(Selectors.SELECT_ALL);
assertTrue(!file.exists());
assertTrue(!file2.exists());
// Delete a file that does not exist
file = folder.resolveFile("some-folder/some-file");
assertTrue(!file.exists());
file.delete(Selectors.SELECT_ALL);