1 19 20 package org.netbeans.core.output2; 21 22 import java.io.Reader ; 23 import junit.framework.TestCase; 24 25 29 public class NbIOTest extends TestCase { 30 31 public NbIOTest(String testName) { 32 super(testName); 33 } 34 35 public void test54117() throws Exception { 36 NbIO io = new NbIO("test"); 37 assertFalse(io.isClosed()); 38 Reader str = io.getIn(); 39 assertNotNull(str); 40 assertEquals(NbIO.IOReader.class, str.getClass()); 41 writeText(str); 42 int read = str.read(new char[100]); 43 assertTrue(read != -1); 45 writeEof(str); 46 read = str.read(new char[100]); 47 assertTrue(read == -1); 48 io.getOut().close(); 50 io.getErr().close(); 51 io.dispose(); 52 io.getOut().reset(); 53 io.getErr().reset(); 54 55 str = io.getIn(); 56 writeText(str); 57 read = str.read(new char[100]); 58 assertTrue(read != -1); 60 writeEof(str); 61 read = str.read(new char[100]); 62 assertTrue(read == -1); 63 64 } 65 66 private void writeText(final Reader reader) { 67 NbIO.IOReader rdr = (NbIO.IOReader)reader; 68 rdr.pushText("hello"); 69 70 } 71 private void writeEof(final Reader reader) { 72 NbIO.IOReader rdr = (NbIO.IOReader)reader; 73 rdr.eof(); 74 } 75 76 } 77 | Popular Tags |