1 22 package org.objectweb.petals.tools.util; 23 24 import java.io.File ; 25 import java.io.FileInputStream ; 26 import java.io.FileNotFoundException ; 27 import java.io.FileOutputStream ; 28 import java.io.IOException ; 29 30 import org.objectweb.petals.tools.jbicommon.util.FileUtil; 31 32 import junit.framework.TestCase; 33 34 39 public class FileUtilTest extends TestCase { 40 41 public void testRemoveDirFalse() { 42 assertFalse(FileUtil.removeDirectory(new File ("toto"))); 43 } 44 45 public void testCopyInputStream() throws FileNotFoundException , IOException { 46 String baseDir = this.getClass().getResource(".").toString(); 47 baseDir = baseDir.substring(0, baseDir.indexOf("target")); 48 baseDir = baseDir.substring(baseDir.indexOf(":")+1); 49 File outputFile= new File (baseDir+"target"+File.separator+"copiedFile.txt"); 50 FileUtil.copyInputStream(new FileInputStream (baseDir+"src"+ File.separator+"test-data" + File.separator + "fileToCopy.txt"), new FileOutputStream (outputFile)); 51 assertTrue(outputFile.exists()); 52 } 53 } 54 | Popular Tags |