1 22 package org.objectweb.petals.util; 23 24 import java.io.File ; 25 import java.io.FileInputStream ; 26 import java.io.IOException ; 27 28 import junit.framework.TestCase; 29 30 35 public class NioUtilTest extends TestCase { 36 37 40 private String baseDir; 41 42 45 public void setUp() { 46 baseDir = this.getClass().getResource(".").toString(); 47 baseDir = baseDir.substring(0, baseDir.indexOf("target")); 48 baseDir = baseDir.substring(baseDir.indexOf(":") + 1); 49 } 50 51 56 public void testCopyStreamToFile() throws IOException { 57 FileInputStream inputStream = new FileInputStream (baseDir + "src" 58 + File.separator + "test-data" + File.separator + "fileToCopy.txt"); 59 NioUtil.copyStreamToFile(inputStream, new File (baseDir + "src" 60 + File.separator + "test-data" + File.separator + "destFile.txt")); 61 } 62 63 } 64 | Popular Tags |