1 17 18 package org.apache.tools.ant.taskdefs; 19 20 import java.io.File ; 21 import java.io.FileOutputStream ; 22 import java.io.IOException ; 23 import java.io.PrintStream ; 24 import org.apache.tools.ant.Project; 25 import org.apache.tools.ant.BuildFileTest; 26 import org.apache.tools.ant.util.FileUtils; 27 28 33 public class InitializeClassTest extends BuildFileTest { 34 35 public InitializeClassTest(String name) { 36 super(name); 37 } 38 39 public void setUp() { 40 configureProject("src/etc/testcases/taskdefs/initializeclass.xml"); 41 } 42 43 public void testAll() throws IOException { 44 executeTarget("forked"); 45 PrintStream ps = System.out; 46 File f1 = new File ("src/etc/testcases/taskdefs/forkedout"); 47 File f2 = new File ("src/etc/testcases/taskdefs/unforkedout"); 48 PrintStream newps = new PrintStream (new FileOutputStream (f2)); 49 System.setOut(newps); 50 project.executeTarget("unforked"); 51 System.setOut(ps); 52 newps.close(); 53 FileUtils fu = FileUtils.newFileUtils(); 54 assertTrue("Forked - non-forked mismatch", fu.contentEquals(f1, f2)); 55 } 56 57 public void tearDown() { 58 File f1 = new File ("src/etc/testcases/taskdefs/forkedout"); 59 File f2 = new File ("src/etc/testcases/taskdefs/unforkedout"); 60 f1.delete(); 61 f2.delete(); 62 } 63 } 64 | Popular Tags |