1 17 package org.apache.servicemix.jbi.util; 18 19 import java.io.File ; 20 21 import junit.framework.TestCase; 22 23 public class FileUtilTest extends TestCase { 24 25 private static File WORKDIR = new File ("target/servicemix-test"); 26 27 protected void setUp() throws Exception { 28 FileUtil.deleteFile(WORKDIR); 29 WORKDIR.mkdirs(); 30 } 31 32 public void testDeleteFile() throws Exception { 33 File f = new File (WORKDIR, "test.txt"); 34 assertFalse(f.exists()); 35 assertTrue(f.createNewFile()); 36 assertTrue(f.exists()); 37 assertFalse(f.isDirectory()); 38 assertTrue(f.isFile()); 39 assertTrue(FileUtil.deleteFile(f)); 40 assertFalse(f.exists()); 41 } 42 43 67 68 public void testDeleteDir() throws Exception { 69 File f = new File (WORKDIR, "testdir"); 70 assertFalse(f.exists()); 71 assertTrue(f.mkdir()); 72 assertTrue(f.exists()); 73 assertTrue(f.isDirectory()); 74 assertFalse(f.isFile()); 75 assertTrue(FileUtil.deleteFile(f)); 76 assertFalse(f.exists()); 77 } 78 79 116 117 } 118 | Popular Tags |