james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1082286 [2/2] - in /james/mime4j/trunk: benchmark/src/main/java/org/apache/james/mime4j/ core/src/main/java/org/apache/james/mime4j/parser/ core/src/main/java/org/apache/james/mime4j/stream/ core/src/test/java/org/apache/james/mime4j/strea...
Date Wed, 16 Mar 2011 20:21:40 GMT
Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MimeTokenStreamBodyDescriptorTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MimeTokenStreamBodyDescriptorTest.java?rev=1082286&r1=1082285&r2=1082286&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MimeTokenStreamBodyDescriptorTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MimeTokenStreamBodyDescriptorTest.java Wed Mar 16 20:21:39 2011
@@ -42,15 +42,15 @@ public class MimeTokenStreamBodyDescript
     }
 
     public void testShouldReturnValidDescriptorForPreamble() throws Exception {
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_HEADER), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_HEADER), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_MULTIPART), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_PREAMBLE), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_HEADER), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_HEADER), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_MULTIPART), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_PREAMBLE), MimeTokenStream.stateToString(parser.next()));
         BodyDescriptor descriptor = parser.getBodyDescriptor();
         assertNotNull(descriptor);
         assertEquals("1729", descriptor.getBoundary());
@@ -58,34 +58,34 @@ public class MimeTokenStreamBodyDescript
     }
     
     public void testShouldReturnValidDescriptorForEpilogue() throws Exception {
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_HEADER), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_HEADER), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_MULTIPART), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_PREAMBLE), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_BODYPART), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_HEADER), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_HEADER), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_BODY), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_BODYPART), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_BODYPART), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_HEADER), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_HEADER), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_BODY), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_BODYPART), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_BODYPART), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_HEADER), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_HEADER), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_BODY), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_BODYPART), MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_EPILOGUE), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_HEADER), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_HEADER), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_MULTIPART), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_PREAMBLE), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_BODYPART), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_HEADER), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_HEADER), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_BODY), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_BODYPART), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_BODYPART), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_HEADER), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_HEADER), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_BODY), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_BODYPART), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_BODYPART), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_HEADER), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_HEADER), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_BODY), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_BODYPART), MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_EPILOGUE), MimeTokenStream.stateToString(parser.next()));
 
         BodyDescriptor descriptor = parser.getBodyDescriptor();
         assertNotNull(descriptor);

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MimeTokenStreamReaderTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MimeTokenStreamReaderTest.java?rev=1082286&r1=1082285&r2=1082286&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MimeTokenStreamReaderTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MimeTokenStreamReaderTest.java Wed Mar 16 20:21:39 2011
@@ -84,37 +84,37 @@ public class MimeTokenStreamReaderTest e
     public void testShouldReadPartBodies() throws IOException, MimeException {
         InputStream in = new ByteArrayInputStream(ExampleMail.MIME_MIXED_MULTIPART_VARIOUS_ENCODINGS_BYTES);
         parser.parse(in);
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_HEADER),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_HEADER),MimeTokenStream.stateToString(parser.next()));
         for (int i=0;i<5;i++) {
-            assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD),MimeTokenStream.stateToString(parser.next()));
+            assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD),MimeTokenStream.stateToString(parser.next()));
         }
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_HEADER),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_MULTIPART),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_PREAMBLE),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_BODYPART),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_HEADER),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_HEADER),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_BODY),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_HEADER),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_MULTIPART),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_PREAMBLE),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_BODYPART),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_HEADER),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_HEADER),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_BODY),MimeTokenStream.stateToString(parser.next()));
         checkBody(ExampleMail.MIME_MIXED_MULTIPART_VARIOUS_ENCODINGS_7BIT);
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_BODYPART),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_BODYPART),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_HEADER),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_HEADER),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_BODY),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_BODYPART),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_BODYPART),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_HEADER),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_HEADER),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_BODY),MimeTokenStream.stateToString(parser.next()));
         checkBody(ExampleMail.MIME_MIXED_MULTIPART_VARIOUS_ENCODINGS_QUOTED_PRINTABLE);
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_BODYPART),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_BODYPART),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_HEADER),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_HEADER),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_BODY),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_BODYPART),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_BODYPART),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_HEADER),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_HEADER),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_BODY),MimeTokenStream.stateToString(parser.next()));
         checkBody(ExampleMail.MIME_MIXED_MULTIPART_VARIOUS_ENCODINGS_BASE64);
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_BODYPART),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_BODYPART),MimeTokenStream.stateToString(parser.next()));
 
         
     }
@@ -122,12 +122,12 @@ public class MimeTokenStreamReaderTest e
     private void checkSimpleMail(byte[] bytes, String body, int fields) throws IOException, MimeException {
         InputStream in = new ByteArrayInputStream(bytes);
         parser.parse(in);
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_START_HEADER),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_START_HEADER),MimeTokenStream.stateToString(parser.next()));
         for (int i=0;i<fields;i++) {
-            assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_FIELD),MimeTokenStream.stateToString(parser.next()));
+            assertEquals(MimeTokenStream.stateToString(EntityState.T_FIELD),MimeTokenStream.stateToString(parser.next()));
         }
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_END_HEADER),MimeTokenStream.stateToString(parser.next()));
-        assertEquals(MimeTokenStream.stateToString(MimeTokenStream.T_BODY),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_END_HEADER),MimeTokenStream.stateToString(parser.next()));
+        assertEquals(MimeTokenStream.stateToString(EntityState.T_BODY),MimeTokenStream.stateToString(parser.next()));
         checkBody(body);
     }
 

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MimeTokenStreamTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MimeTokenStreamTest.java?rev=1082286&r1=1082285&r2=1082286&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MimeTokenStreamTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MimeTokenStreamTest.java Wed Mar 16 20:21:39 2011
@@ -37,46 +37,46 @@ public class MimeTokenStreamTest extends
     public void testSetRecursionModeBeforeParse() throws Exception {
         stream.setRecursionMode(RecursionMode.M_NO_RECURSE);
         stream.parse(new ByteArrayInputStream(ExampleMail.MAIL_WITH_RFC822_PART_BYTES));
-        checkNextIs(EntityStates.T_START_HEADER);
-        checkNextIs(EntityStates.T_FIELD);
-        checkNextIs(EntityStates.T_FIELD);
-        checkNextIs(EntityStates.T_FIELD);
-        checkNextIs(EntityStates.T_FIELD);
-        checkNextIs(EntityStates.T_FIELD);
-        checkNextIs(EntityStates.T_FIELD);
-        checkNextIs(EntityStates.T_END_HEADER);
-        checkNextIs(EntityStates.T_START_MULTIPART);
-        checkNextIs(EntityStates.T_PREAMBLE);
-        checkNextIs(EntityStates.T_START_BODYPART);
-        checkNextIs(EntityStates.T_START_HEADER);
-        checkNextIs(EntityStates.T_END_HEADER);
-        checkNextIs(EntityStates.T_BODY);
-        checkNextIs(EntityStates.T_END_BODYPART);
-        checkNextIs(EntityStates.T_START_BODYPART);
-        checkNextIs(EntityStates.T_START_HEADER);
-        checkNextIs(EntityStates.T_FIELD);
-        checkNextIs(EntityStates.T_END_HEADER);
-        checkNextIs(EntityStates.T_BODY);
-        checkNextIs(EntityStates.T_END_BODYPART);
-        checkNextIs(EntityStates.T_START_BODYPART);
-        checkNextIs(EntityStates.T_START_HEADER);
-        checkNextIs(EntityStates.T_FIELD);
-        checkNextIs(EntityStates.T_END_HEADER);
-        checkNextIs(EntityStates.T_BODY);
-        checkNextIs(EntityStates.T_END_BODYPART);
-        checkNextIs(EntityStates.T_START_BODYPART);
-        checkNextIs(EntityStates.T_START_HEADER);
-        checkNextIs(EntityStates.T_FIELD);
-        checkNextIs(EntityStates.T_END_HEADER);
-        checkNextIs(EntityStates.T_BODY);
-        checkNextIs(EntityStates.T_END_BODYPART);
-        checkNextIs(EntityStates.T_EPILOGUE);
-        checkNextIs(EntityStates.T_END_MULTIPART);
-        checkNextIs(EntityStates.T_END_MESSAGE);
-        checkNextIs(EntityStates.T_END_OF_STREAM);
+        checkNextIs(EntityState.T_START_HEADER);
+        checkNextIs(EntityState.T_FIELD);
+        checkNextIs(EntityState.T_FIELD);
+        checkNextIs(EntityState.T_FIELD);
+        checkNextIs(EntityState.T_FIELD);
+        checkNextIs(EntityState.T_FIELD);
+        checkNextIs(EntityState.T_FIELD);
+        checkNextIs(EntityState.T_END_HEADER);
+        checkNextIs(EntityState.T_START_MULTIPART);
+        checkNextIs(EntityState.T_PREAMBLE);
+        checkNextIs(EntityState.T_START_BODYPART);
+        checkNextIs(EntityState.T_START_HEADER);
+        checkNextIs(EntityState.T_END_HEADER);
+        checkNextIs(EntityState.T_BODY);
+        checkNextIs(EntityState.T_END_BODYPART);
+        checkNextIs(EntityState.T_START_BODYPART);
+        checkNextIs(EntityState.T_START_HEADER);
+        checkNextIs(EntityState.T_FIELD);
+        checkNextIs(EntityState.T_END_HEADER);
+        checkNextIs(EntityState.T_BODY);
+        checkNextIs(EntityState.T_END_BODYPART);
+        checkNextIs(EntityState.T_START_BODYPART);
+        checkNextIs(EntityState.T_START_HEADER);
+        checkNextIs(EntityState.T_FIELD);
+        checkNextIs(EntityState.T_END_HEADER);
+        checkNextIs(EntityState.T_BODY);
+        checkNextIs(EntityState.T_END_BODYPART);
+        checkNextIs(EntityState.T_START_BODYPART);
+        checkNextIs(EntityState.T_START_HEADER);
+        checkNextIs(EntityState.T_FIELD);
+        checkNextIs(EntityState.T_END_HEADER);
+        checkNextIs(EntityState.T_BODY);
+        checkNextIs(EntityState.T_END_BODYPART);
+        checkNextIs(EntityState.T_EPILOGUE);
+        checkNextIs(EntityState.T_END_MULTIPART);
+        checkNextIs(EntityState.T_END_MESSAGE);
+        checkNextIs(EntityState.T_END_OF_STREAM);
     }
     
-    private void checkNextIs(int expected) throws Exception {
+    private void checkNextIs(EntityState expected) throws Exception {
         assertEquals(MimeTokenStream.stateToString(expected), MimeTokenStream.stateToString(stream.next()));        
     }
 }

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MultipartStreamTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MultipartStreamTest.java?rev=1082286&r1=1082285&r2=1082286&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MultipartStreamTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MultipartStreamTest.java Wed Mar 16 20:21:39 2011
@@ -82,67 +82,67 @@ public class MultipartStreamTest extends
     
     public void testShouldSupplyInputStreamForSimpleBody() throws Exception {
         parser.parse(new ByteArrayInputStream(US_ASCII.encode(MESSAGE).array()));
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_START_MULTIPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_START_MULTIPART);
         InputStream out = parser.getInputStream();
         assertEquals(BODY, IOUtils.toString(out, "us-ascii"));
-        checkState(MimeTokenStream.T_END_MULTIPART);
+        checkState(EntityState.T_END_MULTIPART);
     }
     
     public void testInputStreamShouldReadOnlyMessage() throws Exception {
         parser.parse(new ByteArrayInputStream(US_ASCII.encode(COMPLEX_MESSAGE).array()));
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_START_MULTIPART);
-        checkState(MimeTokenStream.T_PREAMBLE);
-        checkState(MimeTokenStream.T_START_BODYPART);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_BODY);
-        checkState(MimeTokenStream.T_END_BODYPART);
-        checkState(MimeTokenStream.T_START_BODYPART);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_START_MESSAGE);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_START_MULTIPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_START_MULTIPART);
+        checkState(EntityState.T_PREAMBLE);
+        checkState(EntityState.T_START_BODYPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_BODY);
+        checkState(EntityState.T_END_BODYPART);
+        checkState(EntityState.T_START_BODYPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_START_MESSAGE);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_START_MULTIPART);
         InputStream out = parser.getInputStream();
         assertEquals(BODY, IOUtils.toString(out, "us-ascii"));
-        checkState(MimeTokenStream.T_END_MULTIPART);
-        checkState(MimeTokenStream.T_END_MESSAGE);
-        checkState(MimeTokenStream.T_END_BODYPART);
-        checkState(MimeTokenStream.T_START_BODYPART);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_BODY);
-        checkState(MimeTokenStream.T_END_BODYPART);
-        checkState(MimeTokenStream.T_EPILOGUE);
-        checkState(MimeTokenStream.T_END_MULTIPART);
-        checkState(MimeTokenStream.T_END_MESSAGE);
-        checkState(MimeTokenStream.T_END_OF_STREAM);
+        checkState(EntityState.T_END_MULTIPART);
+        checkState(EntityState.T_END_MESSAGE);
+        checkState(EntityState.T_END_BODYPART);
+        checkState(EntityState.T_START_BODYPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_BODY);
+        checkState(EntityState.T_END_BODYPART);
+        checkState(EntityState.T_EPILOGUE);
+        checkState(EntityState.T_END_MULTIPART);
+        checkState(EntityState.T_END_MESSAGE);
+        checkState(EntityState.T_END_OF_STREAM);
     }
 
-    private void checkState(final int state) throws IOException, MimeException {
+    private void checkState(final EntityState state) throws IOException, MimeException {
         assertEquals(MimeTokenStream.stateToString(state), MimeTokenStream.stateToString(parser.next()));
     }
 }

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MultipartTokensTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MultipartTokensTest.java?rev=1082286&r1=1082285&r2=1082286&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MultipartTokensTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/MultipartTokensTest.java Wed Mar 16 20:21:39 2011
@@ -106,30 +106,30 @@ public class MultipartTokensTest extends
     
     public void testShouldParseSimpleMessage() throws Exception {
         parser.parse(new ByteArrayInputStream(US_ASCII.encode(MESSAGE).array()));
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_START_MULTIPART);
-        checkState(MimeTokenStream.T_PREAMBLE);
-        checkState(MimeTokenStream.T_START_BODYPART);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_BODY);
-        checkState(MimeTokenStream.T_END_BODYPART);
-        checkState(MimeTokenStream.T_START_BODYPART);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_BODY);
-        checkState(MimeTokenStream.T_END_BODYPART);
-        checkState(MimeTokenStream.T_EPILOGUE);
-        checkState(MimeTokenStream.T_END_MULTIPART);
-        checkState(MimeTokenStream.T_END_MESSAGE);
-        checkState(MimeTokenStream.T_END_OF_STREAM);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_START_MULTIPART);
+        checkState(EntityState.T_PREAMBLE);
+        checkState(EntityState.T_START_BODYPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_BODY);
+        checkState(EntityState.T_END_BODYPART);
+        checkState(EntityState.T_START_BODYPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_BODY);
+        checkState(EntityState.T_END_BODYPART);
+        checkState(EntityState.T_EPILOGUE);
+        checkState(EntityState.T_END_MULTIPART);
+        checkState(EntityState.T_END_MESSAGE);
+        checkState(EntityState.T_END_OF_STREAM);
     }
     
     public void testShouldParseMoreComplexMessage() throws Exception {
@@ -149,161 +149,161 @@ public class MultipartTokensTest extends
             "--outer-boundary--\r\n";
         
         parser.parse(new ByteArrayInputStream(US_ASCII.encode(message).array()));
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_START_MULTIPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_START_MULTIPART);
         // an empty preamble should not rais a T_PREAMBLE event
-        // checkState(MimeTokenStream.T_PREAMBLE);
-        checkState(MimeTokenStream.T_START_BODYPART);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_START_MULTIPART);
+        // checkState(EntityStates.T_PREAMBLE);
+        checkState(EntityState.T_START_BODYPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_START_MULTIPART);
         // an empty preamble should not rais a T_PREAMBLE event
-        // checkState(MimeTokenStream.T_PREAMBLE);
-        checkState(MimeTokenStream.T_START_BODYPART);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_BODY);
-        checkState(MimeTokenStream.T_END_BODYPART);
-        checkState(MimeTokenStream.T_EPILOGUE);
-        checkState(MimeTokenStream.T_END_MULTIPART);
-        checkState(MimeTokenStream.T_END_BODYPART);
-        checkState(MimeTokenStream.T_EPILOGUE);
-        checkState(MimeTokenStream.T_END_MULTIPART);
-        checkState(MimeTokenStream.T_END_MESSAGE);
-        checkState(MimeTokenStream.T_END_OF_STREAM);
+        // checkState(EntityStates.T_PREAMBLE);
+        checkState(EntityState.T_START_BODYPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_BODY);
+        checkState(EntityState.T_END_BODYPART);
+        checkState(EntityState.T_EPILOGUE);
+        checkState(EntityState.T_END_MULTIPART);
+        checkState(EntityState.T_END_BODYPART);
+        checkState(EntityState.T_EPILOGUE);
+        checkState(EntityState.T_END_MULTIPART);
+        checkState(EntityState.T_END_MESSAGE);
+        checkState(EntityState.T_END_OF_STREAM);
     }
     
     public void testShouldParseMessageWithEmbeddedMessage() throws Exception {
         parser.parse(new ByteArrayInputStream(US_ASCII.encode(COMPLEX_MESSAGE).array()));
-        checkState(MimeTokenStream.T_START_HEADER);
-            checkState(MimeTokenStream.T_FIELD);
-            checkState(MimeTokenStream.T_FIELD);
-            checkState(MimeTokenStream.T_FIELD);
-            checkState(MimeTokenStream.T_FIELD);
-            checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_START_MULTIPART);
-            checkState(MimeTokenStream.T_PREAMBLE);
-            checkState(MimeTokenStream.T_START_BODYPART);
-                checkState(MimeTokenStream.T_START_HEADER);
-                    checkState(MimeTokenStream.T_FIELD);
-                checkState(MimeTokenStream.T_END_HEADER);
-                checkState(MimeTokenStream.T_BODY);
-            checkState(MimeTokenStream.T_END_BODYPART);
-            checkState(MimeTokenStream.T_START_BODYPART);
-                checkState(MimeTokenStream.T_START_HEADER);
-                    checkState(MimeTokenStream.T_FIELD);
-                checkState(MimeTokenStream.T_END_HEADER);
-                checkState(MimeTokenStream.T_START_MESSAGE);
-                    checkState(MimeTokenStream.T_START_HEADER);
-                        checkState(MimeTokenStream.T_FIELD);
-                        checkState(MimeTokenStream.T_FIELD);
-                        checkState(MimeTokenStream.T_FIELD);
-                        checkState(MimeTokenStream.T_FIELD);
-                        checkState(MimeTokenStream.T_FIELD);
-                    checkState(MimeTokenStream.T_END_HEADER);
-                    checkState(MimeTokenStream.T_START_MULTIPART);
-                        checkState(MimeTokenStream.T_PREAMBLE);
-                        checkState(MimeTokenStream.T_START_BODYPART);
-                            checkState(MimeTokenStream.T_START_HEADER);
-                            checkState(MimeTokenStream.T_END_HEADER);   
-                            checkState(MimeTokenStream.T_BODY);
-                        checkState(MimeTokenStream.T_END_BODYPART);
-                        checkState(MimeTokenStream.T_START_BODYPART);
-                            checkState(MimeTokenStream.T_START_HEADER);
-                                checkState(MimeTokenStream.T_FIELD);
-                            checkState(MimeTokenStream.T_END_HEADER);
-                            checkState(MimeTokenStream.T_BODY);
-                        checkState(MimeTokenStream.T_END_BODYPART);
-                        checkState(MimeTokenStream.T_EPILOGUE);
-                    checkState(MimeTokenStream.T_END_MULTIPART);
-                checkState(MimeTokenStream.T_END_MESSAGE);
-            checkState(MimeTokenStream.T_END_BODYPART);
-            checkState(MimeTokenStream.T_START_BODYPART);
-                checkState(MimeTokenStream.T_START_HEADER);
-                checkState(MimeTokenStream.T_END_HEADER);
-                checkState(MimeTokenStream.T_BODY);
-            checkState(MimeTokenStream.T_END_BODYPART);
-            checkState(MimeTokenStream.T_EPILOGUE);
-        checkState(MimeTokenStream.T_END_MULTIPART);
-        checkState(MimeTokenStream.T_END_MESSAGE);
-        checkState(MimeTokenStream.T_END_OF_STREAM);
+        checkState(EntityState.T_START_HEADER);
+            checkState(EntityState.T_FIELD);
+            checkState(EntityState.T_FIELD);
+            checkState(EntityState.T_FIELD);
+            checkState(EntityState.T_FIELD);
+            checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_START_MULTIPART);
+            checkState(EntityState.T_PREAMBLE);
+            checkState(EntityState.T_START_BODYPART);
+                checkState(EntityState.T_START_HEADER);
+                    checkState(EntityState.T_FIELD);
+                checkState(EntityState.T_END_HEADER);
+                checkState(EntityState.T_BODY);
+            checkState(EntityState.T_END_BODYPART);
+            checkState(EntityState.T_START_BODYPART);
+                checkState(EntityState.T_START_HEADER);
+                    checkState(EntityState.T_FIELD);
+                checkState(EntityState.T_END_HEADER);
+                checkState(EntityState.T_START_MESSAGE);
+                    checkState(EntityState.T_START_HEADER);
+                        checkState(EntityState.T_FIELD);
+                        checkState(EntityState.T_FIELD);
+                        checkState(EntityState.T_FIELD);
+                        checkState(EntityState.T_FIELD);
+                        checkState(EntityState.T_FIELD);
+                    checkState(EntityState.T_END_HEADER);
+                    checkState(EntityState.T_START_MULTIPART);
+                        checkState(EntityState.T_PREAMBLE);
+                        checkState(EntityState.T_START_BODYPART);
+                            checkState(EntityState.T_START_HEADER);
+                            checkState(EntityState.T_END_HEADER);   
+                            checkState(EntityState.T_BODY);
+                        checkState(EntityState.T_END_BODYPART);
+                        checkState(EntityState.T_START_BODYPART);
+                            checkState(EntityState.T_START_HEADER);
+                                checkState(EntityState.T_FIELD);
+                            checkState(EntityState.T_END_HEADER);
+                            checkState(EntityState.T_BODY);
+                        checkState(EntityState.T_END_BODYPART);
+                        checkState(EntityState.T_EPILOGUE);
+                    checkState(EntityState.T_END_MULTIPART);
+                checkState(EntityState.T_END_MESSAGE);
+            checkState(EntityState.T_END_BODYPART);
+            checkState(EntityState.T_START_BODYPART);
+                checkState(EntityState.T_START_HEADER);
+                checkState(EntityState.T_END_HEADER);
+                checkState(EntityState.T_BODY);
+            checkState(EntityState.T_END_BODYPART);
+            checkState(EntityState.T_EPILOGUE);
+        checkState(EntityState.T_END_MULTIPART);
+        checkState(EntityState.T_END_MESSAGE);
+        checkState(EntityState.T_END_OF_STREAM);
     }
 
     public void testShouldParseMessagesWithEmbeddedQuotedPrintableEncodedMessage() throws Exception {
         parser.parse(new ByteArrayInputStream(US_ASCII.encode(COMPLEX_QP_MESSAGE).array()));
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_START_MESSAGE);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_START_MULTIPART);
-        checkState(MimeTokenStream.T_PREAMBLE);
-        checkState(MimeTokenStream.T_START_BODYPART);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_BODY);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_START_MESSAGE);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_START_MULTIPART);
+        checkState(EntityState.T_PREAMBLE);
+        checkState(EntityState.T_START_BODYPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_BODY);
         assertEquals("text/plain", parser.getBodyDescriptor().getMimeType());
         assertEquals("iso-8859-1", parser.getBodyDescriptor().getCharset());
         assertEquals("Some text\r\n", 
                 IOUtils.toString(parser.getInputStream()));
-        checkState(MimeTokenStream.T_END_BODYPART);
-        checkState(MimeTokenStream.T_START_BODYPART);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_BODY);
+        checkState(EntityState.T_END_BODYPART);
+        checkState(EntityState.T_START_BODYPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_BODY);
         assertEquals("text/html", parser.getBodyDescriptor().getMimeType());
         assertEquals("iso-8859-1", parser.getBodyDescriptor().getCharset());
         assertEquals("<HTML><BODY>= Some HTML =</BODY></HTML>", 
                 IOUtils.toString(parser.getInputStream()));
-        checkState(MimeTokenStream.T_END_BODYPART);
-        checkState(MimeTokenStream.T_EPILOGUE);
-        checkState(MimeTokenStream.T_END_MULTIPART);
-        checkState(MimeTokenStream.T_END_MESSAGE);
-        checkState(MimeTokenStream.T_END_MESSAGE);
-        checkState(MimeTokenStream.T_END_OF_STREAM);
+        checkState(EntityState.T_END_BODYPART);
+        checkState(EntityState.T_EPILOGUE);
+        checkState(EntityState.T_END_MULTIPART);
+        checkState(EntityState.T_END_MESSAGE);
+        checkState(EntityState.T_END_MESSAGE);
+        checkState(EntityState.T_END_OF_STREAM);
     }
     
     public void testMultipartMessageWithoutHeader() throws Exception {
         parser.parseHeadless(new ByteArrayInputStream(US_ASCII.encode(BODY).array()), 
                 "multipart/mixed;boundary=1729");
         // see https://issues.apache.org/jira/browse/MIME4J-153
-        // checkState(MimeTokenStream.T_END_HEADER);
+        // checkState(EntityStates.T_END_HEADER);
         
         // see https://issues.apache.org/jira/browse/MIME4J-153
-        // checkState(MimeTokenStream.T_START_MULTIPART);
+        // checkState(EntityStates.T_START_MULTIPART);
         
         // actually T_START_MULTIPART is the first state, but the 
         // checkState method calls next() before checking.
-        checkState(MimeTokenStream.T_PREAMBLE);
-        checkState(MimeTokenStream.T_START_BODYPART);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_BODY);
-        checkState(MimeTokenStream.T_END_BODYPART);
-        checkState(MimeTokenStream.T_START_BODYPART);
-        checkState(MimeTokenStream.T_START_HEADER);
-        checkState(MimeTokenStream.T_FIELD);
-        checkState(MimeTokenStream.T_END_HEADER);
-        checkState(MimeTokenStream.T_BODY);
-        checkState(MimeTokenStream.T_END_BODYPART);
-        checkState(MimeTokenStream.T_EPILOGUE);
-        checkState(MimeTokenStream.T_END_MULTIPART);
-        checkState(MimeTokenStream.T_END_MESSAGE);
-        checkState(MimeTokenStream.T_END_OF_STREAM);
+        checkState(EntityState.T_PREAMBLE);
+        checkState(EntityState.T_START_BODYPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_BODY);
+        checkState(EntityState.T_END_BODYPART);
+        checkState(EntityState.T_START_BODYPART);
+        checkState(EntityState.T_START_HEADER);
+        checkState(EntityState.T_FIELD);
+        checkState(EntityState.T_END_HEADER);
+        checkState(EntityState.T_BODY);
+        checkState(EntityState.T_END_BODYPART);
+        checkState(EntityState.T_EPILOGUE);
+        checkState(EntityState.T_END_MULTIPART);
+        checkState(EntityState.T_END_MESSAGE);
+        checkState(EntityState.T_END_OF_STREAM);
     }
     
-    private void checkState(final int state) throws IOException, MimeException {
+    private void checkState(final EntityState state) throws IOException, MimeException {
         assertEquals(MimeTokenStream.stateToString(state), MimeTokenStream.stateToString(parser.next()));
     }
 }

Modified: james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/StrictMimeTokenStreamTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/StrictMimeTokenStreamTest.java?rev=1082286&r1=1082285&r2=1082286&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/StrictMimeTokenStreamTest.java (original)
+++ james/mime4j/trunk/core/src/test/java/org/apache/james/mime4j/stream/StrictMimeTokenStreamTest.java Wed Mar 16 20:21:39 2011
@@ -35,8 +35,8 @@ public class StrictMimeTokenStreamTest e
         MimeTokenStream parser = new MimeTokenStream(config);
         parser.parse(new ByteArrayInputStream(HEADER_ONLY.getBytes()));
         
-        assertEquals("Headers start", MimeTokenStream.T_START_HEADER, parser.next());
-        assertEquals("Field", MimeTokenStream.T_FIELD, parser.next());
+        assertEquals("Headers start", EntityState.T_START_HEADER, parser.next());
+        assertEquals("Field", EntityState.T_FIELD, parser.next());
         try {
             parser.next();
             fail("Expected exception to be thrown");
@@ -53,9 +53,9 @@ public class StrictMimeTokenStreamTest e
         
         parser.parse(new ByteArrayInputStream(CORRECT_HEADERS.getBytes()));
         
-        assertEquals("Headers start", MimeTokenStream.T_START_HEADER, parser.next());
-        assertEquals("From header", MimeTokenStream.T_FIELD, parser.next());
-        assertEquals("Subject header", MimeTokenStream.T_FIELD, parser.next());
-        assertEquals("End message", MimeTokenStream.T_END_HEADER, parser.next());
+        assertEquals("Headers start", EntityState.T_START_HEADER, parser.next());
+        assertEquals("From header", EntityState.T_FIELD, parser.next());
+        assertEquals("Subject header", EntityState.T_FIELD, parser.next());
+        assertEquals("End message", EntityState.T_END_HEADER, parser.next());
      }
 }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/message/MaximalBodyDescriptorTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/message/MaximalBodyDescriptorTest.java?rev=1082286&r1=1082285&r2=1082286&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/message/MaximalBodyDescriptorTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/message/MaximalBodyDescriptorTest.java Wed Mar 16 20:21:39 2011
@@ -27,6 +27,7 @@ import org.apache.james.mime4j.message.M
 import org.apache.james.mime4j.message.MaximalBodyDescriptorFactory;
 import org.apache.james.mime4j.stream.BaseTestForBodyDescriptors;
 import org.apache.james.mime4j.stream.BodyDescriptor;
+import org.apache.james.mime4j.stream.EntityState;
 import org.apache.james.mime4j.stream.MimeEntityConfig;
 import org.apache.james.mime4j.stream.MimeTokenStream;
 import org.apache.james.mime4j.stream.MutableBodyDescriptor;
@@ -156,14 +157,14 @@ public class MaximalBodyDescriptorTest e
     private MaximalBodyDescriptor describe(byte[] mail, int zeroBasedPart) throws Exception {
         ByteArrayInputStream bias = new ByteArrayInputStream(mail);
         parser.parse(bias);
-        int state = parser.next();
-        while (state != MimeTokenStream.T_END_OF_STREAM && zeroBasedPart>=0) {
+        EntityState state = parser.next();
+        while (state != EntityState.T_END_OF_STREAM && zeroBasedPart>=0) {
             state = parser.next();
-            if (state == MimeTokenStream.T_BODY) {
+            if (state == EntityState.T_BODY) {
                 --zeroBasedPart;
             }
         }
-        assertEquals(MimeTokenStream.T_BODY, state);
+        assertEquals(EntityState.T_BODY, state);
         BodyDescriptor descriptor = parser.getBodyDescriptor();
         assertNotNull(descriptor);
         assertTrue("Parser is maximal so body descriptor should be maximal", descriptor instanceof MaximalBodyDescriptor);
@@ -173,12 +174,12 @@ public class MaximalBodyDescriptorTest e
     private MaximalBodyDescriptor describe(byte[] mail) throws Exception {
         ByteArrayInputStream bias = new ByteArrayInputStream(mail);
         parser.parse(bias);
-        int state = parser.next();
-        while (state != MimeTokenStream.T_BODY && state != MimeTokenStream.T_END_OF_STREAM) 
+        EntityState state = parser.next();
+        while (state != EntityState.T_BODY && state != EntityState.T_END_OF_STREAM) 
         {
             state = parser.next();
         }
-        assertEquals(MimeTokenStream.T_BODY, state);
+        assertEquals(EntityState.T_BODY, state);
         BodyDescriptor descriptor = parser.getBodyDescriptor();
         assertNotNull(descriptor);
         assertTrue("Parser is maximal so body descriptor should be maximal", descriptor instanceof MaximalBodyDescriptor);



Mime
View raw message