Author: sgoeschl
Date: Thu May 13 20:43:01 2010
New Revision: 944008

URL: http://svn.apache.org/viewvc?rev=944008&view=rev
Log:
[EMAIL-73] Adding a test case but unable to reproduce the issue

Modified:
    
commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java

Modified: 
commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java?rev=944008&r1=944007&r2=944008&view=diff
==============================================================================
--- 
commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java 
(original)
+++ 
commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java 
Thu May 13 20:43:01 2010
@@ -46,8 +46,6 @@ public class HtmlEmailTest extends BaseE
         super(name);
     }
 
-    /**
-     * @throws Exception  */
     protected void setUp() throws Exception
     {
         super.setUp();
@@ -55,8 +53,6 @@ public class HtmlEmailTest extends BaseE
         this.email = new MockHtmlEmailConcrete();
     }
 
-    /**
-     * @throws EmailException  */
     public void testGetSetTextMsg() throws EmailException
     {
         // ====================================================================
@@ -86,9 +82,6 @@ public class HtmlEmailTest extends BaseE
 
     }
 
-    /**
-     * @throws EmailException if setting the message fails
-     */
     public void testGetSetHtmlMsg() throws EmailException
     {
         // ====================================================================
@@ -118,8 +111,6 @@ public class HtmlEmailTest extends BaseE
 
     }
 
-    /**
-     * @throws EmailException  */
     public void testGetSetMsg() throws EmailException
     {
         // ====================================================================
@@ -152,10 +143,6 @@ public class HtmlEmailTest extends BaseE
 
     }
 
-    /**
-     *
-     * @throws Exception Exception
-     */
     public void testEmbedUrl() throws Exception
     {
         // ====================================================================
@@ -403,10 +390,6 @@ public class HtmlEmailTest extends BaseE
             true);
     }
 
-    /**
-     *
-     * @throws Exception Exception
-     */
     public void testSend2() throws Exception
     {
         // ====================================================================
@@ -597,4 +580,40 @@ public class HtmlEmailTest extends BaseE
 
         fail("Expecting an exception when calling buildMimeMessage() before 
send() ...");
     }
+
+    /**
+     * EMAIL-73 - check that providing a plain text content using setMsg()
+     * creates a plain content and HTML content using <pre> tags.
+     */
+    public void testSendWithPlainTextButNoHtmlContent() throws EmailException, 
IOException
+    {
+        this.getMailServer();
+
+        String strSubject = "testSendWithPlainTextButNoHtmlContent";
+
+        this.email = new MockHtmlEmailConcrete();
+        this.email.setHostName(this.strTestMailServer);
+        this.email.setSmtpPort(this.getMailServerPort());
+        this.email.setFrom(this.strTestMailFrom);
+        this.email.addTo(this.strTestMailTo);
+        this.email.setAuthentication(this.strTestUser, this.strTestPasswd);
+        this.email.setCharset(Email.ISO_8859_1);
+        this.email.setSubject(strSubject);
+        this.email.setMsg("This is a plain text content : 
<b><&npsb;></html></b>");
+
+        this.email.send();
+
+        this.fakeMailServer.stop();
+
+        // validate txt message
+        validateSend(
+            this.fakeMailServer,
+            strSubject,
+            this.email.getTextMsg(),
+            this.email.getFromAddress(),
+            this.email.getToAddresses(),
+            this.email.getCcAddresses(),
+            this.email.getBccAddresses(),
+            true);
+    }
 }


Reply via email to