1 36 package org.columba.ristretto.smtp; 37 38 import java.io.ByteArrayInputStream ; 39 import java.io.IOException ; 40 import java.io.InputStream ; 41 42 import junit.framework.TestCase; 43 44 public class StopWordSafeInputStreamTest extends TestCase { 45 46 public void test1() throws IOException { 47 String test = "bla\r\n.\r\nbla"; 48 InputStream in = new StopWordSafeInputStream( new ByteArrayInputStream (test.getBytes())); 49 50 StringBuffer result = new StringBuffer (); 51 int read = in.read(); 52 while(read != -1 ) { 53 result.append((char)read); 54 read = in.read(); 55 } 56 57 assertTrue(result.toString().equals("bla\r\n..\r\nbla")); 58 } 59 60 public void test2() throws IOException { 61 String test = "bla 15.10.\r\nbla"; 62 InputStream in = new StopWordSafeInputStream( new ByteArrayInputStream (test.getBytes())); 63 64 StringBuffer result = new StringBuffer (); 65 int read = in.read(); 66 while(read != -1 ) { 67 result.append((char)read); 68 read = in.read(); 69 } 70 71 assertTrue(result.toString().equals("bla 15.10.\r\nbla")); 72 } 73 } 74 | Popular Tags |