1 19 package org.enhydra.zeus.result; 20 21 import java.io.IOException ; 22 import java.io.ByteArrayOutputStream ; 23 import java.io.OutputStream ; 24 import java.io.OutputStreamWriter ; 25 import java.io.Writer ; 26 import java.io.StringWriter ; 27 28 import org.enhydra.zeus.Result; 30 31 import junit.framework.Test; 33 import junit.framework.TestCase; 34 import junit.framework.TestSuite; 35 36 44 public class StreamResultTest extends TestCase { 45 46 55 public StreamResultTest(String testName) { 56 super(testName); 57 } 58 59 68 public static Test suite(){ 69 return new TestSuite(StreamResultTest.class); 70 } 71 72 78 public void testStreamResultConstructor() { 79 OutputStream out = new ByteArrayOutputStream (); 80 StreamResult result = 81 new StreamResult(out, "file:///test/system/ID.xml"); 82 result = new StreamResult(out); 83 StringWriter writer = new StringWriter (); 84 result = new StreamResult(writer); 85 } 86 87 93 public void testGetSystemID() { 94 OutputStream out = new ByteArrayOutputStream (); 95 String id = "file:///test/system/ID.xml"; 96 StreamResult result = new StreamResult(out, id); 97 assertEquals(id, result.getSystemID()); 98 } 99 100 106 public void testSetSystemID() { 107 OutputStream out = new ByteArrayOutputStream (); 108 StreamResult result = new StreamResult(out); 109 String id = "file:///test/system/ID.xml"; 110 result.setSystemID(id); 111 assertEquals(id, result.getSystemID()); 112 } 113 114 122 public void testWrite() { 123 try { 124 StringWriter writer = new StringWriter (); 125 StreamResult result = new StreamResult(writer); 126 result.write("<testOutput>Some Test output</testOutput>"); 127 } catch( IOException e) { 128 fail(e.getMessage()); 129 } 130 } 131 } 132 | Popular Tags |