commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1082156 - /commons/proper/net/trunk/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java
Date Wed, 16 Mar 2011 14:19:04 GMT
Author: sebb
Date: Wed Mar 16 14:19:04 2011
New Revision: 1082156

URL: http://svn.apache.org/viewvc?rev=1082156&view=rev
Log:
Add some more tests

Modified:
    commons/proper/net/trunk/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java

Modified: commons/proper/net/trunk/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java?rev=1082156&r1=1082155&r2=1082156&view=diff
==============================================================================
--- commons/proper/net/trunk/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java
(original)
+++ commons/proper/net/trunk/src/test/java/org/apache/commons/net/io/DotTerminatedMessageReaderTest.java
Wed Mar 16 14:19:04 2011
@@ -91,6 +91,54 @@ public class DotTerminatedMessageReaderT
         assertEquals("Hello World!" + SEP+".text"+SEP,str.toString());
     }
 
+    public void testEmbeddedDot1() throws IOException {
+        final String test = "Hello . World!\r\n.\r\n";
+        reader = new DotTerminatedMessageReader(new StringReader(test));
+
+        int read = 0;
+        while ((read = reader.read(buf)) != -1) {
+            str.append(buf, 0, read);
+        }
+
+        assertEquals("Hello . World!" + SEP,str.toString());
+    }
+
+    public void testEmbeddedDot2() throws IOException {
+        final String test = "Hello .. World!\r\n.\r\n";
+        reader = new DotTerminatedMessageReader(new StringReader(test));
+
+        int read = 0;
+        while ((read = reader.read(buf)) != -1) {
+            str.append(buf, 0, read);
+        }
+
+        assertEquals("Hello .. World!" + SEP,str.toString());
+    }
+
+    public void testEmbeddedDot3() throws IOException {
+        final String test = "Hello World.\r\nmore\r\n.\r\n";
+        reader = new DotTerminatedMessageReader(new StringReader(test));
+
+        int read = 0;
+        while ((read = reader.read(buf)) != -1) {
+            str.append(buf, 0, read);
+        }
+
+        assertEquals("Hello World." + SEP+"more"+SEP,str.toString());
+    }
+
+    public void testEmbeddedDot4() throws IOException {
+        final String test = "Hello World\r.\nmore\r\n.\r\n";
+        reader = new DotTerminatedMessageReader(new StringReader(test));
+
+        int read = 0;
+        while ((read = reader.read(buf)) != -1) {
+            str.append(buf, 0, read);
+        }
+
+        assertEquals("Hello World\r.\nmore" + SEP,str.toString());
+    }
+
     // This test agrees with the Javadoc.
     // However the sequence should not happen for well-behaved NNTP and POP3 servers
     public void testSingleDotWithTrailingText() throws IOException {



Mime
View raw message