commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1429382 - in /commons/proper/email/trunk/src/test/java/org/apache/commons/mail: EmailTest.java mocks/MockEmailConcrete.java
Date Sat, 05 Jan 2013 20:39:12 GMT
Author: tn
Date: Sat Jan  5 20:39:12 2013
New Revision: 1429382

URL: http://svn.apache.org/viewvc?rev=1429382&view=rev
Log:
[EMAIL-123] Added unit test, removed unneeded methods in MockEmailConcrete.

Modified:
    commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java
    commons/proper/email/trunk/src/test/java/org/apache/commons/mail/mocks/MockEmailConcrete.java

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java?rev=1429382&r1=1429381&r2=1429382&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java Sat Jan
 5 20:39:12 2013
@@ -1271,6 +1271,29 @@ public class EmailTest extends BaseEmail
             this.fakeMailServer.stop();
             assertTrue(true);
         }
+        
+        // validate that the correct smtp port is visible in the exception message
+        // in case ssl connection is used
+        try
+        {
+            this.getMailServer();
+
+            this.email = new MockEmailConcrete();
+            this.email.setHostName("bad.host.com");
+            this.email.setSSL(true);
+            this.email.setFrom(this.strTestMailFrom);
+            this.email.addTo(this.strTestMailTo);
+            this.email.setAuthentication(null, null);
+            this.email.send();
+            fail("Should have thrown an exception");
+        }
+        catch (EmailException e)
+        {
+            assertTrue(e.getMessage().contains("bad.host.com:465"));
+            this.fakeMailServer.stop();
+            assertTrue(true);
+        }
+        
     }
 
     /** */
@@ -1428,5 +1451,5 @@ public class EmailTest extends BaseEmail
         MimeMessage msg = this.email.getMimeMessage();
         msg.saveChanges();
         assertEquals("image/png", msg.getContentType());
-    }
+    }    
 }

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/mocks/MockEmailConcrete.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/mocks/MockEmailConcrete.java?rev=1429382&r1=1429381&r2=1429382&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/mocks/MockEmailConcrete.java
(original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/mocks/MockEmailConcrete.java
Sat Jan  5 20:39:12 2013
@@ -161,24 +161,6 @@ public class MockEmailConcrete extends E
     }
 
     /**
-     * @return smtpPort
-     */
-    @Override
-    public String getSmtpPort()
-    {
-        return this.smtpPort;
-    }
-
-    /**
-     * @return subject
-     */
-    @Override
-    public String getSubject()
-    {
-        return this.subject;
-    }
-
-    /**
      * @return contentType
      */
     public String getContentType()



Mime
View raw message