org.apache.commons.mail
Class EmailTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.mail.BaseEmailTestCase
              extended by org.apache.commons.mail.EmailTest
All Implemented Interfaces:
junit.framework.Test

public class EmailTest
extends BaseEmailTestCase

JUnit test case for Email Class

Since:
1.0
Version:
$Id: EmailTest.java 513307 2007-03-01 13:22:34Z dion $
Author:
Corey Scott

Field Summary
static String[] ARR_VALID_EMAILS
          valid email addresses
 
Fields inherited from class org.apache.commons.mail.BaseEmailTestCase
BODY_END_PAD, BODY_START_PAD, fakeMailServer, strTestMailFrom, strTestMailServer, strTestMailTo, strTestPasswd, strTestURL, strTestUser, testCharsNotValid, testCharsValid
 
Constructor Summary
EmailTest(String name)
           
 
Method Summary
protected  void setUp()
           
 void testAddBcc()
           
 void testAddBcc2()
           
 void testAddBccWithEncoding()
           
 void testAddCc()
           
 void testAddCc2()
           
 void testAddCcWithEncoding()
           
 void testAddHeader()
           
 void testAddHeaderEx()
           
 void testAddReplyTo()
           
 void testAddReplyTo2()
           
 void testAddReplyToWithEncoding()
           
 void testAddTo()
           
 void testAddTo2()
           
 void testAddToWithEncoding()
           
 void testDefaultCharsetAppliesToTextContent()
          Test: When Email.setCharset() is called, a subsequent setContent() should use that charset for text content types unless overridden by the contentType parameter.
 void testDefaultCharsetCanBeOverriddenByContentType()
          Case 2: A default charset is overridden by an explicitly specified charset in setContent().
 void testDefaultCharsetIgnoredByNonTextContent()
          Case 3: A non-text content object ignores a default charset entirely.
 void testGetSetAuthentication()
           
 void testGetSetAuthenticator()
           
 void testGetSetCharset()
           
 void testGetSetDebug()
           
 void testGetSetHostName()
           
 void testGetSetSentDate()
           
 void testGetSetSession()
           
 void testGetSetSmtpPort()
           
 void testSendEx()
           
 void testSetBcc()
           
 void testSetCc()
           
 void testSetContentMimeMultipart()
           
 void testSetContentObject()
           
 void testSetFrom()
           
 void testSetFrom2()
           
 void testSetFromWithEncoding()
           
 void testSetHeaders()
           
 void testSetHeadersEx()
           
 void testSetPopBeforeSmtp()
           
 void testSetSubject()
           
 void testSetTo()
           
 void testToInternetAddressArray()
           
 
Methods inherited from class org.apache.commons.mail.BaseEmailTestCase
getMailServer, getMailServerPort, getMessageAsString, isMailServerStopped, saveEmailToFile, tearDown, validateSend, validateSend, validateSend
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ARR_VALID_EMAILS

public static final String[] ARR_VALID_EMAILS
valid email addresses

Constructor Detail

EmailTest

public EmailTest(String name)
Parameters:
name - test name
Method Detail

setUp

protected void setUp()
              throws Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception

testGetSetDebug

public void testGetSetDebug()

testGetSetSession

public void testGetSetSession()
                       throws Exception
Throws:
Exception - Exception

testGetSetAuthentication

public void testGetSetAuthentication()

testGetSetAuthenticator

public void testGetSetAuthenticator()

testGetSetCharset

public void testGetSetCharset()

testSetContentMimeMultipart

public void testSetContentMimeMultipart()

testSetContentObject

public void testSetContentObject()

testGetSetHostName

public void testGetSetHostName()

testGetSetSmtpPort

public void testGetSetSmtpPort()

testSetFrom

public void testSetFrom()
                 throws Exception
Throws:
Exception - Exception

testSetFromWithEncoding

public void testSetFromWithEncoding()
                             throws Exception
Throws:
Exception - Exception

testSetFrom2

public void testSetFrom2()
                  throws Exception
Throws:
Exception - Exception

testAddTo

public void testAddTo()
               throws org.apache.commons.mail.EmailException,
                      UnsupportedEncodingException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testAddToWithEncoding

public void testAddToWithEncoding()
                           throws UnsupportedEncodingException,
                                  org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testAddTo2

public void testAddTo2()
                throws UnsupportedEncodingException,
                       org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testSetTo

public void testSetTo()
               throws UnsupportedEncodingException,
                      org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testAddCc

public void testAddCc()
               throws UnsupportedEncodingException,
                      org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testAddCcWithEncoding

public void testAddCcWithEncoding()
                           throws UnsupportedEncodingException,
                                  org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testAddCc2

public void testAddCc2()
                throws UnsupportedEncodingException,
                       org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testSetCc

public void testSetCc()
               throws org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address

testAddBcc

public void testAddBcc()
                throws UnsupportedEncodingException,
                       org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testAddBccWithEncoding

public void testAddBccWithEncoding()
                            throws UnsupportedEncodingException,
                                   org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testAddBcc2

public void testAddBcc2()
                 throws UnsupportedEncodingException,
                        org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testSetBcc

public void testSetBcc()
                throws UnsupportedEncodingException,
                       org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testAddReplyTo

public void testAddReplyTo()
                    throws UnsupportedEncodingException,
                           org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testAddReplyToWithEncoding

public void testAddReplyToWithEncoding()
                                throws UnsupportedEncodingException,
                                       org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testAddReplyTo2

public void testAddReplyTo2()
                     throws UnsupportedEncodingException,
                            org.apache.commons.mail.EmailException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testAddHeader

public void testAddHeader()

testAddHeaderEx

public void testAddHeaderEx()

testSetHeaders

public void testSetHeaders()

testSetHeadersEx

public void testSetHeadersEx()

testSetSubject

public void testSetSubject()

testSendEx

public void testSendEx()

testGetSetSentDate

public void testGetSetSentDate()

testToInternetAddressArray

public void testToInternetAddressArray()
                                throws org.apache.commons.mail.EmailException,
                                       UnsupportedEncodingException
Throws:
EmailException - when there are problems adding an address
UnsupportedEncodingException - on bad email addresses

testSetPopBeforeSmtp

public void testSetPopBeforeSmtp()

testDefaultCharsetAppliesToTextContent

public void testDefaultCharsetAppliesToTextContent()
                                            throws Exception
Test: When Email.setCharset() is called, a subsequent setContent() should use that charset for text content types unless overridden by the contentType parameter. See https://issues.apache.org/jira/browse/EMAIL-1. Case 1: Setting a default charset results in adding that charset info to to the content type of a text/based content object.

Throws:
Exception - on any error

testDefaultCharsetCanBeOverriddenByContentType

public void testDefaultCharsetCanBeOverriddenByContentType()
                                                    throws Exception
Case 2: A default charset is overridden by an explicitly specified charset in setContent().

Throws:
Exception - on any error

testDefaultCharsetIgnoredByNonTextContent

public void testDefaultCharsetIgnoredByNonTextContent()
                                               throws Exception
Case 3: A non-text content object ignores a default charset entirely.

Throws:
Exception - on any error


Copyright © 2001-2010 Apache Software Foundation. All Rights Reserved.