james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r674337 - /james/mime4j/trunk/src/test/java/org/apache/james/mime4j/MimeTokenNoRecurseTest.java
Date Sun, 06 Jul 2008 19:41:12 GMT
Author: rdonkin
Date: Sun Jul  6 12:41:11 2008
New Revision: 674337

URL: http://svn.apache.org/viewvc?rev=674337&view=rev
Log:
Extra test coverage.

Modified:
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/MimeTokenNoRecurseTest.java

Modified: james/mime4j/trunk/src/test/java/org/apache/james/mime4j/MimeTokenNoRecurseTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/MimeTokenNoRecurseTest.java?rev=674337&r1=674336&r2=674337&view=diff
==============================================================================
--- james/mime4j/trunk/src/test/java/org/apache/james/mime4j/MimeTokenNoRecurseTest.java (original)
+++ james/mime4j/trunk/src/test/java/org/apache/james/mime4j/MimeTokenNoRecurseTest.java Sun
Jul  6 12:41:11 2008
@@ -139,6 +139,37 @@
         nextIs(MimeTokenStream.T_EPILOGUE);
         nextIs(MimeTokenStream.T_END_MULTIPART);
     }
+    
+    public void testWhenNoRecurseInputStreamShouldContainInnerMail() throws Exception {
+        stream.setRecursionMode(MimeTokenStream.M_NO_RECURSE);
+        nextIs(MimeTokenStream.T_START_HEADER);
+        nextIs(MimeTokenStream.T_FIELD);
+        nextIs(MimeTokenStream.T_FIELD);
+        nextIs(MimeTokenStream.T_FIELD);
+        nextIs(MimeTokenStream.T_FIELD);
+        nextIs(MimeTokenStream.T_FIELD);
+        nextIs(MimeTokenStream.T_FIELD);
+        nextIs(MimeTokenStream.T_END_HEADER);
+        
+        nextIs(MimeTokenStream.T_START_MULTIPART);
+        nextIs(MimeTokenStream.T_PREAMBLE);
+        nextShouldBeStandardPart(false);
+        
+        nextShouldBeStandardPart(true);
+        nextIs(MimeTokenStream.T_START_BODYPART);
+        nextIs(MimeTokenStream.T_START_HEADER);
+        nextIs(MimeTokenStream.T_FIELD);
+        nextIs(MimeTokenStream.T_END_HEADER);
+        nextIs(MimeTokenStream.T_BODY);
+        InputStream inputStream = stream.getInputStream();
+        int next = inputStream.read();
+        int i=0;
+        while (next != -1) {
+            assertEquals("@" + i, INNER_MAIL.charAt(i++), (char) next);
+            next = inputStream.read();
+        }
+        assertEquals(INNER_MAIL.length()-2, i);
+    }
 
     private void nextShouldBeStandardPart(boolean withHeader) throws Exception {
         nextIs(MimeTokenStream.T_START_BODYPART);



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message