commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r1507607 - /commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java
Date Sat, 27 Jul 2013 09:13:22 GMT
Author: britter
Date: Sat Jul 27 09:13:22 2013
New Revision: 1507607

URL: http://svn.apache.org/r1507607
Log:
Split up test instead of iterating over an array with test values

Modified:
    commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.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=1507607&r1=1507606&r2=1507607&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 Jul
27 09:13:22 2013
@@ -18,6 +18,7 @@ package org.apache.commons.mail;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -159,16 +160,28 @@ public class EmailTest extends AbstractE
     }
 
     @Test
+    public void testSetContentEmptyMimeMultipart()
+    {
+        MimeMultipart part = new MimeMultipart();
+        email.setContent(part);
+
+        assertEquals(part, email.getContentMimeMultipart());
+    }
+
+    @Test
     public void testSetContentMimeMultipart()
     {
-        MimeMultipart[] tests =
-            {new MimeMultipart(), new MimeMultipart("abc123"), null};
+        MimeMultipart part = new MimeMultipart("abc123");
+        email.setContent(part);
 
-        for (int i = 0; i < tests.length; i++)
-        {
-            email.setContent(tests[i]);
-            assertEquals(tests[i], email.getContentMimeMultipart());
-        }
+        assertEquals(part, email.getContentMimeMultipart());
+    }
+
+    @Test
+    public void testSetContentNull() throws Exception
+    {
+        email.setContent(null);
+        assertNull(email.getContentMimeMultipart());
     }
 
     @Test



Mime
View raw message