1 package org.objectweb.celtix.tools.common; 2 3 import java.io.ByteArrayOutputStream ; 4 import java.io.PrintStream ; 5 import java.net.URL ; 6 7 import junit.framework.TestCase; 8 9 public abstract class ToolTestBase extends TestCase { 10 11 protected PrintStream oldStdErr; 12 protected PrintStream oldStdOut; 13 protected URL wsdlLocation; 14 15 protected ByteArrayOutputStream errOut = new ByteArrayOutputStream (); 16 protected ByteArrayOutputStream stdOut = new ByteArrayOutputStream (); 17 18 public void setUp() { 19 20 oldStdErr = System.err; 21 oldStdOut = System.out; 22 23 System.setErr(new PrintStream (errOut)); 24 System.setOut(new PrintStream (stdOut)); 25 26 wsdlLocation = ToolTestBase.class.getResource("/wsdl/hello_world.wsdl"); 27 } 28 29 public void tearDown() { 30 31 System.setErr(oldStdErr); 32 System.setOut(oldStdOut); 33 } 34 35 protected String getStdOut() { 36 return new String (stdOut.toByteArray()); 37 } 38 protected String getStdErr() { 39 return new String (errOut.toByteArray()); 40 } 41 42 } 43 44 | Popular Tags |