1 20 package org.apache.cactus.internal.util; 21 22 import java.io.ByteArrayInputStream ; 23 import java.io.IOException ; 24 25 import junit.framework.TestCase; 26 27 32 public class TestIoUtil extends TestCase 33 { 34 40 public void testGetTextOk() throws IOException 41 { 42 String expected = 43 "<html><head/>\n<body>A GET request</body>\n</html>\n"; 44 ByteArrayInputStream in = new ByteArrayInputStream (expected.getBytes()); 45 46 String result = IoUtil.getText(in); 47 48 assertEquals(expected, result); 49 } 50 51 57 public void testGetTextEmpty() throws IOException 58 { 59 ByteArrayInputStream in = new ByteArrayInputStream ("".getBytes()); 60 61 String result = IoUtil.getText(in); 62 63 assertEquals("", result); 64 } 65 } 66 | Popular Tags |