epugh 2004/11/02 03:13:26
Modified: email/src/test/org/apache/commons/mail HtmlEmailTest.java
EmailTest.java MultiPartEmailTest.java
BaseEmailTestCase.java SimpleEmailTest.java
email/src/test/org/apache/commons/mail/mocks
MockHtmlEmailConcrete.java
MockMultiPartEmailConcrete.java
MockSimpleEmail.java
email/src/java/org/apache/commons/mail HtmlEmail.java
Log:
Fixed unit tests problems with bad characters
Revision Changes Path
1.9 +164 -9
jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/HtmlEmailTest.java
Index: HtmlEmailTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/HtmlEmailTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- HtmlEmailTest.java 1 Nov 2004 13:54:59 -0000 1.8
+++ HtmlEmailTest.java 2 Nov 2004 11:13:25 -0000 1.9
@@ -56,7 +56,9 @@
/** */
public void testGetSetTextMsg()
{
-
+ // ====================================================================
+ // Test Success
+ // ====================================================================
try
{
for (int i = 0; i < testCharsValid.length; i++)
@@ -69,11 +71,36 @@
{
e.printStackTrace();
}
+
+ // ====================================================================
+ // Test Exception
+ // ====================================================================
+ for (int i = 0; i < this.testCharsNotValid.length; i++)
+ {
+ try
+ {
+ this.email.setTextMsg(this.testCharsNotValid[i]);
+ fail("Should have thrown an exception");
+ }
+ catch (MessagingException e)
+ {
+ assertTrue(true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail("Unexpected exception thrown");
+ }
+ }
+
}
/** */
public void testGetSetHtmlMsg()
{
+ // ====================================================================
+ // Test Success
+ // ====================================================================
try
{
for (int i = 0; i < testCharsValid.length; i++)
@@ -86,11 +113,36 @@
{
e.printStackTrace();
}
+
+ // ====================================================================
+ // Test Exception
+ // ====================================================================
+ for (int i = 0; i < this.testCharsNotValid.length; i++)
+ {
+ try
+ {
+ this.email.setHtmlMsg(this.testCharsNotValid[i]);
+ fail("Should have thrown an exception");
+ }
+ catch (MessagingException e)
+ {
+ assertTrue(true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail("Unexpected exception thrown");
+ }
+ }
+
}
/** */
public void testGetSetMsg()
{
+ // ====================================================================
+ // Test Success
+ // ====================================================================
try
{
for (int i = 0; i < testCharsValid.length; i++)
@@ -106,6 +158,28 @@
{
e.printStackTrace();
}
+
+ // ====================================================================
+ // Test Exception
+ // ====================================================================
+ for (int i = 0; i < this.testCharsNotValid.length; i++)
+ {
+ try
+ {
+ this.email.setMsg(this.testCharsNotValid[i]);
+ fail("Should have thrown an exception");
+ }
+ catch (MessagingException e)
+ {
+ assertTrue(true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail("Unexpected exception thrown");
+ }
+ }
+
}
/** */
@@ -206,7 +280,38 @@
this.email.send();
this.fakeMailServer.stop();
- assertTrue(validateSend(fakeMailServer, strSubject));
+ // validate txt message
+ validateSend(
+ this.fakeMailServer,
+ strSubject,
+ this.email.getTextMsg(),
+ this.email.getFromAddress(),
+ this.email.getToList(),
+ this.email.getCcList(),
+ this.email.getBccList(),
+ true);
+
+ // validate html message
+ validateSend(
+ this.fakeMailServer,
+ strSubject,
+ this.email.getHtmlMsg(),
+ this.email.getFromAddress(),
+ this.email.getToList(),
+ this.email.getCcList(),
+ this.email.getBccList(),
+ false);
+
+ // validate attachment
+ validateSend(
+ this.fakeMailServer,
+ strSubject,
+ attachment.getName(),
+ this.email.getFromAddress(),
+ this.email.getToList(),
+ this.email.getCcList(),
+ this.email.getBccList(),
+ false);
}
catch (MessagingException e)
{
@@ -242,11 +347,20 @@
String strSubject = "Test HTML Send #1 Subject (wo charset)";
this.email.setSubject(strSubject);
- this.email.setMsg("Test message");
+ this.email.setTextMsg("Test message");
this.email.send();
this.fakeMailServer.stop();
- assertTrue(validateSend(fakeMailServer, strSubject));
+ // validate txt message
+ validateSend(
+ this.fakeMailServer,
+ strSubject,
+ this.email.getTextMsg(),
+ this.email.getFromAddress(),
+ this.email.getToList(),
+ this.email.getCcList(),
+ this.email.getBccList(),
+ true);
}
catch (MessagingException e)
{
@@ -284,11 +398,31 @@
String strSubject = "Test HTML Send #2 Subject (wo charset)";
this.email.setSubject(strSubject);
- this.email.setTextMsg("Test txt msg");
+ this.email.setMsg("Test txt msg");
this.email.send();
this.fakeMailServer.stop();
- assertTrue(validateSend(fakeMailServer, strSubject));
+ // validate txt message
+ validateSend(
+ this.fakeMailServer,
+ strSubject,
+ this.email.getTextMsg(),
+ this.email.getFromAddress(),
+ this.email.getToList(),
+ this.email.getCcList(),
+ this.email.getBccList(),
+ true);
+
+ // validate html message
+ validateSend(
+ this.fakeMailServer,
+ strSubject,
+ this.email.getHtmlMsg(),
+ this.email.getFromAddress(),
+ this.email.getToList(),
+ this.email.getCcList(),
+ this.email.getBccList(),
+ false);
}
catch (MessagingException e)
{
@@ -319,11 +453,31 @@
String strSubject = "Test HTML Send #2 Subject (w charset)";
this.email.setCharset(Email.ISO_8859_1);
this.email.setSubject(strSubject);
- this.email.setTextMsg("Test txt msg");
+ this.email.setMsg("Test txt msg");
this.email.send();
this.fakeMailServer.stop();
- assertTrue(validateSend(fakeMailServer, strSubject));
+ // validate txt message
+ validateSend(
+ this.fakeMailServer,
+ strSubject,
+ this.email.getTextMsg(),
+ this.email.getFromAddress(),
+ this.email.getToList(),
+ this.email.getCcList(),
+ this.email.getBccList(),
+ true);
+
+ // validate html message
+ validateSend(
+ this.fakeMailServer,
+ strSubject,
+ this.email.getHtmlMsg(),
+ this.email.getFromAddress(),
+ this.email.getToList(),
+ this.email.getCcList(),
+ this.email.getBccList(),
+ false);
}
catch (MessagingException e)
{
@@ -335,4 +489,5 @@
e1.printStackTrace();
}
}
+
}
1.10 +3 -62
jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/EmailTest.java
Index: EmailTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/EmailTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- EmailTest.java 1 Nov 2004 13:54:59 -0000 1.9
+++ EmailTest.java 2 Nov 2004 11:13:25 -0000 1.10
@@ -15,7 +15,6 @@
*/
package org.apache.commons.mail;
-import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Calendar;
@@ -66,7 +65,7 @@
// reusable objects to be used across multiple tests
this.email = new MockEmailConcrete();
}
-
+
/** */
public void testGetSetDebug()
{
@@ -419,7 +418,7 @@
anotherEmail.setCharset("bad.encoding\uc5ec\n");
// set a valid address but bad personal name
anotherEmail.setFrom(
- "[EMAIL PROTECTED]",
+ "[EMAIL PROTECTED]",
"\t.bad.personal.name.\uc5ec\n");
fail("Should have thrown an exception");
}
@@ -1439,64 +1438,6 @@
{
this.email.setSubject(testCharsValid[i]);
assertEquals(testCharsValid[i], this.email.getSubject());
- }
- }
-
- /**
- * @todo Add code to test the popBeforeSmtp() settings
- * @todo (Not necessary, but would add completeness)
- * add code to recall the message property
- * of the class instances and then verfiy that all
- * settings were made to this correctly
- */
- public void testSend()
- {
- // ====================================================================
- // Test Success
- // ====================================================================
- try
- {
- this.getMailServer();
-
- this.email = new MockEmailConcrete();
- this.email.setHostName(this.strTestMailServer);
- this.email.setFrom(this.strTestMailFrom);
- this.email.addTo(this.strTestMailTo);
-
- if (this.strTestUser != null && this.strTestPasswd != null)
- {
- this.email.setAuthentication(
- this.strTestUser,
- this.strTestPasswd);
- }
-
- String strSubject = "Test Msg Subject";
- this.email.setCharset(Email.ISO_8859_1);
- this.email.setSubject(strSubject);
-
- this.email.setContent(new MimeMultipart("abc123"));
-
- Hashtable ht = new Hashtable();
- ht.put("X-Priority", "1");
- ht.put("Disposition-Notification-To", this.strTestMailFrom);
- ht.put("X-Mailer", "Sendmail");
-
- this.email.setHeaders(ht);
-// this.email.setDebug(true);
- this.email.send();
-
- this.fakeMailServer.stop();
- assertTrue(validateSend(fakeMailServer, strSubject));
- }
- catch (MessagingException e)
- {
- e.printStackTrace();
- fail("Unexpected exception thrown");
- }
- catch (IOException e)
- {
- e.printStackTrace();
- fail("failed to save email to output file");
}
}
1.9 +85 -14
jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/MultiPartEmailTest.java
Index: MultiPartEmailTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/MultiPartEmailTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- MultiPartEmailTest.java 1 Nov 2004 13:55:00 -0000 1.8
+++ MultiPartEmailTest.java 2 Nov 2004 11:13:26 -0000 1.9
@@ -23,6 +23,7 @@
import javax.activation.URLDataSource;
import javax.mail.MessagingException;
+import javax.mail.internet.MimeMultipart;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.mail.mocks.MockMultiPartEmailConcrete;
@@ -137,14 +138,15 @@
this.getMailServer();
String strSubject = "Test Multipart Send Subject";
-
+
EmailAttachment attachment = new EmailAttachment();
attachment.setPath(testFile.getAbsolutePath());
attachment.setDisposition(EmailAttachment.ATTACHMENT);
attachment.setName("Test_Attachment");
attachment.setDescription("Test Attachment Desc");
- MultiPartEmail testEmail = new MultiPartEmail();
+ MockMultiPartEmailConcrete testEmail =
+ new MockMultiPartEmailConcrete();
testEmail.setHostName(this.strTestMailServer);
testEmail.setFrom(this.strTestMailFrom);
testEmail.addTo(this.strTestMailTo);
@@ -173,7 +175,27 @@
testEmail.send();
this.fakeMailServer.stop();
- assertTrue(validateSend(fakeMailServer, strSubject));
+ // validate message
+ validateSend(
+ this.fakeMailServer,
+ strSubject,
+ testEmail.getMsg(),
+ testEmail.getFromAddress(),
+ testEmail.getToList(),
+ testEmail.getCcList(),
+ testEmail.getBccList(),
+ true);
+
+ // validate attachment
+ validateSend(
+ this.fakeMailServer,
+ strSubject,
+ attachment.getName(),
+ testEmail.getFromAddress(),
+ testEmail.getToList(),
+ testEmail.getCcList(),
+ testEmail.getBccList(),
+ false);
}
catch (MessagingException e)
{
@@ -413,22 +435,71 @@
}
}
- /** @todo implement test for GetPrimaryBodyPart */
- public void testGetPrimaryBodyPart()
- {
- assertTrue(true);
- }
-
- /** @todo implement test for AddPart(content, contentType) */
+ /** */
public void testAddPart()
{
- assertTrue(true);
+ try
+ {
+ // setup
+ this.email = new MockMultiPartEmailConcrete();
+ String strMessage = "hello";
+ String strContentType = "text/plain";
+
+ // add part
+ this.email.addPart(strMessage, strContentType);
+
+ // validate
+ assertEquals(
+ strContentType,
+ this.email.getContainer().getBodyPart(0).getContentType());
+ assertEquals(
+ strMessage,
+ this
+ .email
+ .getContainer()
+ .getBodyPart(0)
+ .getDataHandler()
+ .getContent());
+ }
+ catch (MessagingException e)
+ {
+ e.printStackTrace();
+ fail("Unexpected exception thrown");
+ }
+ catch (IOException e1)
+ {
+ e1.printStackTrace();
+ }
}
- /** @todo implement test for AddPart(MimeMultipart) */
+ /** */
public void testAddPart2()
{
- assertTrue(true);
+ try
+ {
+ // setup
+ this.email = new MockMultiPartEmailConcrete();
+ String strSubtype = "subtype/abc123";
+
+ // add part
+ this.email.addPart(new MimeMultipart(strSubtype));
+
+ // validate
+ assertTrue(
+ this
+ .email
+ .getContainer()
+ .getBodyPart(0)
+ .getDataHandler()
+ .getContentType()
+ .indexOf(strSubtype)
+ != -1);
+ }
+ catch (MessagingException e)
+ {
+ e.printStackTrace();
+ fail("Unexpected exception thrown");
+ }
}
/** @todo implement test for GetContainer */
1.5 +150 -18
jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/BaseEmailTestCase.java
Index: BaseEmailTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/BaseEmailTestCase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BaseEmailTestCase.java 1 Nov 2004 13:55:00 -0000 1.4
+++ BaseEmailTestCase.java 2 Nov 2004 11:13:26 -0000 1.5
@@ -18,9 +18,13 @@
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
+import javax.mail.Multipart;
+import javax.mail.internet.InternetAddress;
+
import junit.framework.TestCase;
import org.apache.commons.mail.settings.EmailConfiguration;
@@ -56,22 +60,25 @@
protected String strTestPasswd = EmailConfiguration.TEST_PASSWD;
/** URL to used to test URL attachmetns (Must be valid) */
protected String strTestURL = EmailConfiguration.TEST_URL;
+
+ /** Padding at end of body added by dumbser/send */
+ public static final int BODY_END_PAD = 3;
+ /** Padding at start of body added by dumbser/send */
+ public static final int BODY_START_PAD = 2;
/** Where to save email output **/
private File emailOutputDir;
+ /** Test characters acceptable to email */
protected String[] testCharsValid =
{
- "",
- " ",
- "a",
- "A",
- "�",
- "�",
- "0123456789",
- "012345678901234567890",
- "\n",
- null
+ " ",
+ "a",
+ "A",
+ "\uc5ec",
+ "0123456789",
+ "012345678901234567890",
+ "\n"
};
/** Array of test strings */
@@ -90,6 +97,7 @@
}
}
+ /** */
protected void setUp()
{
@@ -106,7 +114,7 @@
this.fakeMailServer = null;
}
-
+
/**
*
* @param email email
@@ -152,20 +160,144 @@
* Validate the message was sent properly
* @param mailServer reference to the fake mail server
* @param strSubject expected subject
- * @return boolean true if all is well, false otherwise
+ * @param fromAdd expected from address
+ * @param toAdd arraylist of expected to addresses
+ * @param ccAdd arraylist of expected cc addresses
+ * @param bccAdd arraylist of expected bcc addresses
+ * @param boolSaveToFile true will output to file, false doesnt
+ * @return SmtpMessage email to check
* @throws IOException Exception
*/
- protected boolean validateSend(
+ protected SmtpMessage validateSend(
SimpleSmtpServer mailServer,
- String strSubject)
+ String strSubject,
+ InternetAddress fromAdd,
+ ArrayList toAdd,
+ ArrayList ccAdd,
+ ArrayList bccAdd,
+ boolean boolSaveToFile)
throws IOException
{
assertTrue(mailServer.getReceievedEmailSize() == 1);
Iterator emailIter = fakeMailServer.getReceivedEmail();
SmtpMessage emailMessage = (SmtpMessage) emailIter.next();
- this.saveEmailToFile(emailMessage);
+ if (boolSaveToFile)
+ {
+ this.saveEmailToFile(emailMessage);
+ }
+
+ // test subject
+ assertEquals(strSubject, emailMessage.getHeaderValue("Subject"));
+
+ //test from address
+ assertEquals(fromAdd.toString(), emailMessage.getHeaderValue("From"));
+
+ //test to address
+ assertTrue(
+ toAdd.toString().indexOf(emailMessage.getHeaderValue("To")) != -1);
- return strSubject.equals(emailMessage.getHeaderValue("Subject"));
- }
+ //test cc address
+ if (ccAdd.size() > 0)
+ {
+ assertTrue(
+ ccAdd.toString().indexOf(emailMessage.getHeaderValue("Cc"))
+ != -1);
+ }
+
+ //test bcc address
+ if (bccAdd.size() > 0)
+ {
+ assertTrue(
+ bccAdd.toString().indexOf(emailMessage.getHeaderValue("Bcc"))
+ != -1);
+ }
+
+ return emailMessage;
+ }
+
+ /**
+ * Validate the message was sent properly
+ * @param mailServer reference to the fake mail server
+ * @param strSubject expected subject
+ * @param content the expected message content
+ * @param fromAdd expected from address
+ * @param toAdd arraylist of expected to addresses
+ * @param ccAdd arraylist of expected cc addresses
+ * @param bccAdd arraylist of expected bcc addresses
+ * @param boolSaveToFile true will output to file, false doesnt
+ * @throws IOException Exception
+ */
+ protected void validateSend(
+ SimpleSmtpServer mailServer,
+ String strSubject,
+ Multipart content,
+ InternetAddress fromAdd,
+ ArrayList toAdd,
+ ArrayList ccAdd,
+ ArrayList bccAdd,
+ boolean boolSaveToFile)
+ throws IOException
+ {
+ // test other properties
+ SmtpMessage emailMessage = this.validateSend(
+ mailServer,
+ strSubject,
+ fromAdd,
+ toAdd,
+ ccAdd,
+ bccAdd,
+ boolSaveToFile);
+
+ // test message content
+
+ // get sent email content
+ String strSentContent =
+ content.getContentType();
+ // get received email content (chop off the auto-added \n
+ // and -- (front and end)
+ String strMessageBody =
+ emailMessage.getBody().substring(
+ BaseEmailTestCase.BODY_START_PAD,
+ emailMessage.getBody().length()
+ - BaseEmailTestCase.BODY_END_PAD);
+ assertTrue(strMessageBody.indexOf(strSentContent) != -1);
+ }
+
+ /**
+ * Validate the message was sent properly
+ * @param mailServer reference to the fake mail server
+ * @param strSubject expected subject
+ * @param strMessage the expected message as a string
+ * @param fromAdd expected from address
+ * @param toAdd arraylist of expected to addresses
+ * @param ccAdd arraylist of expected cc addresses
+ * @param bccAdd arraylist of expected bcc addresses
+ * @param boolSaveToFile true will output to file, false doesnt
+ * @throws IOException Exception
+ */
+ protected void validateSend(
+ SimpleSmtpServer mailServer,
+ String strSubject,
+ String strMessage,
+ InternetAddress fromAdd,
+ ArrayList toAdd,
+ ArrayList ccAdd,
+ ArrayList bccAdd,
+ boolean boolSaveToFile)
+ throws IOException
+ {
+ // test other properties
+ SmtpMessage emailMessage = this.validateSend(
+ mailServer,
+ strSubject,
+ fromAdd,
+ toAdd,
+ ccAdd,
+ bccAdd,
+ true);
+
+ // test message content
+ assertTrue(emailMessage.getBody().indexOf(strMessage) != -1);
+ }
}
1.5 +84 -1
jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/SimpleEmailTest.java
Index: SimpleEmailTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/SimpleEmailTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SimpleEmailTest.java 1 Nov 2004 13:55:00 -0000 1.4
+++ SimpleEmailTest.java 2 Nov 2004 11:13:26 -0000 1.5
@@ -15,6 +15,8 @@
*/
package org.apache.commons.mail;
+import java.io.IOException;
+
import javax.mail.MessagingException;
import org.apache.commons.mail.mocks.MockSimpleEmail;
@@ -47,7 +49,9 @@
/** */
public void testGetSetMsg()
{
-
+ // ====================================================================
+ // Test Success
+ // ====================================================================
try
{
for (int i = 0; i < testCharsValid.length; i++)
@@ -60,6 +64,85 @@
{
e.printStackTrace();
fail("Unexpected exception thrown");
+ }
+
+ // ====================================================================
+ // Test Exception
+ // ====================================================================
+ for (int i = 0; i < this.testCharsNotValid.length; i++)
+ {
+ try
+ {
+ this.email.setMsg(this.testCharsNotValid[i]);
+ fail("Should have thrown an exception");
+ }
+ catch (MessagingException e)
+ {
+ assertTrue(true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail("Unexpected exception thrown");
+ }
+ }
+
+ }
+
+ /**
+ * @todo Add code to test the popBeforeSmtp() settings
+ */
+ public void testSend()
+ {
+ // ====================================================================
+ // Test Success
+ // ====================================================================
+ try
+ {
+ this.getMailServer();
+
+ this.email = new MockSimpleEmail();
+ this.email.setHostName(this.strTestMailServer);
+ this.email.setFrom(this.strTestMailFrom);
+ this.email.addTo(this.strTestMailTo);
+
+ if (this.strTestUser != null && this.strTestPasswd != null)
+ {
+ this.email.setAuthentication(
+ this.strTestUser,
+ this.strTestPasswd);
+ }
+
+ String strSubject = "Test Msg Subject";
+ String strMessage = "Test Msg Body";
+
+ this.email.setCharset(Email.ISO_8859_1);
+ this.email.setSubject(strSubject);
+
+ this.email.setMsg(strMessage);
+
+ this.email.send();
+
+ this.fakeMailServer.stop();
+ validateSend(
+ this.fakeMailServer,
+ strSubject,
+ this.email.getMsg(),
+ this.email.getFromAddress(),
+ this.email.getToList(),
+ this.email.getCcList(),
+ this.email.getBccList(),
+ true);
+ }
+ catch (MessagingException e)
+ {
+ e.printStackTrace();
+ fail("Unexpected exception thrown");
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ fail("failed to save email to output file");
}
}
}
1.4 +37 -1
jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/mocks/MockHtmlEmailConcrete.java
Index: MockHtmlEmailConcrete.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/mocks/MockHtmlEmailConcrete.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MockHtmlEmailConcrete.java 27 Oct 2004 09:53:46 -0000 1.3
+++ MockHtmlEmailConcrete.java 2 Nov 2004 11:13:26 -0000 1.4
@@ -15,8 +15,11 @@
*/
package org.apache.commons.mail.mocks;
+import java.util.ArrayList;
import java.util.List;
+import javax.mail.internet.InternetAddress;
+
import org.apache.commons.mail.HtmlEmail;
/**
@@ -53,4 +56,37 @@
{
return inlineImages;
}
+
+ /**
+ * @return fromAddress
+ */
+ public InternetAddress getFromAddress()
+ {
+ return this.fromAddress;
+ }
+
+ /**
+ * @return toList
+ */
+ public ArrayList getToList()
+ {
+ return this.toList;
+ }
+
+ /**
+ * @return bccList
+ */
+ public ArrayList getBccList()
+ {
+ return this.bccList;
+ }
+
+ /**
+ * @return ccList
+ */
+ public ArrayList getCcList()
+ {
+ return this.ccList;
+ }
+
}
1.5 +36 -1
jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/mocks/MockMultiPartEmailConcrete.java
Index: MockMultiPartEmailConcrete.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/mocks/MockMultiPartEmailConcrete.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MockMultiPartEmailConcrete.java 28 Oct 2004 19:28:03 -0000 1.4
+++ MockMultiPartEmailConcrete.java 2 Nov 2004 11:13:26 -0000 1.5
@@ -16,8 +16,10 @@
package org.apache.commons.mail.mocks;
import java.io.IOException;
+import java.util.ArrayList;
import javax.mail.MessagingException;
+import javax.mail.internet.InternetAddress;
import org.apache.commons.mail.MultiPartEmail;
@@ -58,4 +60,37 @@
{
this.init();
}
+
+ /**
+ * @return fromAddress
+ */
+ public InternetAddress getFromAddress()
+ {
+ return this.fromAddress;
+ }
+
+ /**
+ * @return toList
+ */
+ public ArrayList getToList()
+ {
+ return this.toList;
+ }
+
+ /**
+ * @return bccList
+ */
+ public ArrayList getBccList()
+ {
+ return this.bccList;
+ }
+
+ /**
+ * @return ccList
+ */
+ public ArrayList getCcList()
+ {
+ return this.ccList;
+ }
+
}
1.4 +37 -1
jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/mocks/MockSimpleEmail.java
Index: MockSimpleEmail.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/email/src/test/org/apache/commons/mail/mocks/MockSimpleEmail.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MockSimpleEmail.java 27 Oct 2004 09:53:46 -0000 1.3
+++ MockSimpleEmail.java 2 Nov 2004 11:13:26 -0000 1.4
@@ -15,6 +15,10 @@
*/
package org.apache.commons.mail.mocks;
+import java.util.ArrayList;
+
+import javax.mail.internet.InternetAddress;
+
import org.apache.commons.mail.SimpleEmail;
/**
@@ -33,6 +37,38 @@
public String getMsg()
{
return (String) this.content;
+ }
+
+ /**
+ * @return fromAddress
+ */
+ public InternetAddress getFromAddress()
+ {
+ return this.fromAddress;
+ }
+
+ /**
+ * @return toList
+ */
+ public ArrayList getToList()
+ {
+ return this.toList;
+ }
+
+ /**
+ * @return bccList
+ */
+ public ArrayList getBccList()
+ {
+ return this.bccList;
+ }
+
+ /**
+ * @return ccList
+ */
+ public ArrayList getCcList()
+ {
+ return this.ccList;
}
}
1.15 +1 -14
jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/HtmlEmail.java
Index: HtmlEmail.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/HtmlEmail.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- HtmlEmail.java 1 Nov 2004 13:55:02 -0000 1.14
+++ HtmlEmail.java 2 Nov 2004 11:13:26 -0000 1.15
@@ -254,17 +254,4 @@
super.send();
}
-
- /**
- * Validates that the supplied string is neither <code>null</code>
- * nor the empty string.
- *
- * @param foo The text to check.
- * @return Whether valid.
- * @deprecated use StringUtils.isNotEmpty instead
- */
- public static final boolean isValid(String foo)
- {
- return StringUtils.isNotEmpty(foo);
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]