You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/12/04 20:13:44 UTC
svn commit: r1417122 -
/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java
Author: sebb
Date: Tue Dec 4 19:13:43 2012
New Revision: 1417122
URL: http://svn.apache.org/viewvc?rev=1417122&view=rev
Log:
Cannot use strings here; cf. setBcc and setTo
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=1417122&r1=1417121&r2=1417122&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 Tue Dec 4 19:13:43 2012
@@ -30,6 +30,7 @@ import java.util.Map;
import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.Session;
+import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
@@ -750,16 +751,16 @@ public class EmailTest extends BaseEmail
/**
* @throws EmailException when there are problems adding an address
*/
- public void testSetCc() throws EmailException
+ public void testSetCc() throws EmailException, AddressException
{
// ====================================================================
// Test Success
// ====================================================================
- List<String> testEmailValid2 = new ArrayList<String>();
- testEmailValid2.add("Name1 <me...@home.com>");
- testEmailValid2.add("\"joe.doe@apache.org\" <jo...@apache.org>");
+ List<InternetAddress> testEmailValid2 = new ArrayList<InternetAddress>();
+ testEmailValid2.add(new InternetAddress("Name1 <me...@home.com>"));
+ testEmailValid2.add(new InternetAddress("\"joe.doe@apache.org\" <jo...@apache.org>"));
testEmailValid2.add(
- "\"someone_here@work.com.au\" <so...@work.com.au>");
+ new InternetAddress("\"someone_here@work.com.au\" <so...@work.com.au>"));
this.email.setCc(testEmailValid2);
assertEquals(testEmailValid2, this.email.getCcAddresses());
@@ -782,7 +783,7 @@ public class EmailTest extends BaseEmail
// ====================================================================
try
{
- this.email.setCc(new ArrayList<String>());
+ this.email.setCc(new ArrayList<InternetAddress>());
fail("Should have thrown an exception");
}
catch (EmailException e)