1 4 package org.oddjob.io; 5 6 import java.io.InputStream ; 7 import java.io.OutputStream ; 8 9 import junit.framework.TestCase; 10 11 import org.oddjob.arooa.reflect.IntrospectionHelper; 12 13 16 public class BufferTypeTest extends TestCase { 17 18 public void testOutputStream() throws Exception { 19 BufferType bt = new BufferType(); 20 OutputStream os = (OutputStream ) IntrospectionHelper.valueFor(bt, OutputStream .class); 21 os.write('A'); 22 os.close(); 23 24 assertEquals("A", IntrospectionHelper.valueFor(bt, String .class)); 25 assertEquals("A", IntrospectionHelper.valueFor(os, String .class)); 26 27 InputStream is = (InputStream ) IntrospectionHelper.valueFor(os, InputStream .class); 28 int i = is.read(); 29 assertEquals(65, i); 30 is.close(); 31 } 32 } 33 | Popular Tags |