james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r659982 - /james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java
Date Sun, 25 May 2008 13:55:02 GMT
Author: rdonkin
Date: Sun May 25 06:55:02 2008
New Revision: 659982

URL: http://svn.apache.org/viewvc?rev=659982&view=rev
Log:
Confirmed and fixed MIME4J-36 NullPointerException in Header.writeTo with missing Content-Type
https://issues.apache.org/jira/browse/MIME4J-36.

Added:
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java

Added: james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java?rev=659982&view=auto
==============================================================================
--- james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java
(added)
+++ james/mime4j/trunk/src/test/java/org/apache/james/mime4j/message/MessageWriteToTest.java
Sun May 25 06:55:02 2008
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.james.mime4j.message;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import org.apache.james.mime4j.ExampleMail;
+import org.apache.james.mime4j.util.MessageUtils;
+
+import junit.framework.TestCase;
+
+public class MessageWriteToTest extends TestCase {
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+    
+    public void testSimpleMailStrictIgnore() throws Exception {
+        Message message = createMessage(ExampleMail.RFC822_SIMPLE_BYTES);
+        assertFalse("Not multipart", message.isMultipart());
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        message.writeTo(out, MessageUtils.STRICT_IGNORE);
+    }
+    
+    public void testSimpleMailStrictError() throws Exception {
+        Message message = createMessage(ExampleMail.RFC822_SIMPLE_BYTES);
+        assertFalse("Not multipart", message.isMultipart());
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        message.writeTo(out, MessageUtils.STRICT_ERROR);
+    }
+    
+    public void testSimpleMailLenient() throws Exception {
+        Message message = createMessage(ExampleMail.RFC822_SIMPLE_BYTES);
+        assertFalse("Not multipart", message.isMultipart());
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        message.writeTo(out, MessageUtils.LENIENT);
+    }
+    
+    private Message createMessage(byte[] octets) throws Exception {
+        ByteArrayInputStream in = new ByteArrayInputStream(octets);
+        Message message = new Message(in);
+        return message;
+    }
+}



---------------------------------------------------------------------
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