test.atlassian.mail
Class TestMailUtils

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bycom.atlassian.core.ofbiz.test.AbstractOFBizTestCase
              extended bytest.atlassian.mail.TestMailUtils
All Implemented Interfaces:
junit.framework.Test

public class TestMailUtils
extends com.atlassian.core.ofbiz.test.AbstractOFBizTestCase


Constructor Summary
TestMailUtils(java.lang.String s)
           
 
Method Summary
protected  void setUp()
           
protected  void tearDown()
           
 void testBinaryAttachmentPartContentIsEmpty()
           
 void testBinaryAttachmentPartContentIsNotEmpty()
           
 void testCreateAttachmentMimeBodyPartFileNames()
           
 void testCreateAttachmentMimeBodyPartFileNames2()
           
 void testGetAttachmentsHasAttachments()
           
 void testGetAttachmentsIfContentEncodingIsNotSupported()
           
 void testGetAttachmentsNoAttachments()
           
 void testGetAuthorFromSender()
           
 void testGetBody()
           
 void testGetBodyHtml()
           
 void testGetBodyMultipartAlternativeGetsTextMatch()
           
 void testGetBodyMultipartGetsFirstTextMatch()
           
 void testGetBodyMultipartGetsHtmlIfNoText()
           
 void testGetBodyMultipartMixed()
           
 void testGetBodyMultipartMixedWithLotsOfTextAndHtml()
           
 void testGetBodyMultipartNoMatch()
           
 void testGetBodyText()
           
 void testGetBodyTextIfContentEncodingUnsupported()
           
 void testGetContentTypeFromHeaderValue()
           
 void testGetContentTypeFromHeaderValueWithParameter()
           
 void testGetFirstValidUser()
           
 void testGetSenders()
          Creating edge cases for this test is difficult because the mail api tries to stop you doing funky things with nulls, blanks and padded values for addresses.
 void testHasRecipient()
           
 void testInlineAttachment()
           
 void testInlineAttachmentThatIsntBase64Encoded()
          This test tests the oddf case where a part has a content-id but is not base64 encoded(aka binary) and therefore fails to be recognised as a probable inline part.
 void testIsAttachmentPart()
           
 void testIsHtmlPart()
           
 void testIsImageAttachedPart()
           
 void testIsInlineImagePart()
           
 void testIsInlineImagePartWherePartHasDisposition()
           
 void testIsPlainTextPart()
           
 void testIsRelatedPart()
           
 void testNegativePartIsSignature()
           
 void testParseAddresses()
           
 void testPositivePartIsSignature()
           
 void testTextPartContentIsEmpty()
           
 void testTextPartContentIsEmptyBecauseContainsOnlyWhitespace()
           
 void testTextPartContentIsEmptyOnNullContent()
           
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestMailUtils

public TestMailUtils(java.lang.String s)
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Throws:
java.lang.Exception

tearDown

protected void tearDown()
                 throws java.lang.Exception
Throws:
java.lang.Exception

testParseAddresses

public void testParseAddresses()
                        throws javax.mail.internet.AddressException
Throws:
javax.mail.internet.AddressException

testGetBody

public void testGetBody()
                 throws javax.mail.MessagingException,
                        java.io.IOException
Throws:
javax.mail.MessagingException
java.io.IOException

testGetAuthorFromSender

public void testGetAuthorFromSender()
                             throws javax.mail.MessagingException,
                                    com.opensymphony.user.ImmutableException,
                                    com.opensymphony.user.DuplicateEntityException
Throws:
javax.mail.MessagingException
com.opensymphony.user.ImmutableException
com.opensymphony.user.DuplicateEntityException

testGetFirstValidUser

public void testGetFirstValidUser()
                           throws com.opensymphony.user.ImmutableException,
                                  com.opensymphony.user.DuplicateEntityException,
                                  javax.mail.internet.AddressException
Throws:
com.opensymphony.user.ImmutableException
com.opensymphony.user.DuplicateEntityException
javax.mail.internet.AddressException

testGetSenders

public void testGetSenders()
                    throws java.lang.Exception
Creating edge cases for this test is difficult because the mail api tries to stop you doing funky things with nulls, blanks and padded values for addresses. This looks like the 80% coverage with 20% effort.

Throws:
java.lang.Exception

testHasRecipient

public void testHasRecipient()
                      throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

testCreateAttachmentMimeBodyPartFileNames

public void testCreateAttachmentMimeBodyPartFileNames()
                                               throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

testCreateAttachmentMimeBodyPartFileNames2

public void testCreateAttachmentMimeBodyPartFileNames2()
                                                throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

testGetBodyText

public void testGetBodyText()
                     throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

testGetBodyTextIfContentEncodingUnsupported

public void testGetBodyTextIfContentEncodingUnsupported()
                                                 throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

testGetBodyHtml

public void testGetBodyHtml()
                     throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

testGetBodyMultipartAlternativeGetsTextMatch

public void testGetBodyMultipartAlternativeGetsTextMatch()
                                                  throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

testGetBodyMultipartGetsFirstTextMatch

public void testGetBodyMultipartGetsFirstTextMatch()
                                            throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

testGetBodyMultipartGetsHtmlIfNoText

public void testGetBodyMultipartGetsHtmlIfNoText()
                                          throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

testGetBodyMultipartNoMatch

public void testGetBodyMultipartNoMatch()
                                 throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

testGetBodyMultipartMixed

public void testGetBodyMultipartMixed()
                               throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

testGetBodyMultipartMixedWithLotsOfTextAndHtml

public void testGetBodyMultipartMixedWithLotsOfTextAndHtml()
                                                    throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

testGetAttachmentsNoAttachments

public void testGetAttachmentsNoAttachments()
                                     throws javax.mail.MessagingException,
                                            java.io.IOException
Throws:
javax.mail.MessagingException
java.io.IOException

testGetAttachmentsIfContentEncodingIsNotSupported

public void testGetAttachmentsIfContentEncodingIsNotSupported()
                                                       throws javax.mail.MessagingException,
                                                              java.io.IOException
Throws:
javax.mail.MessagingException
java.io.IOException

testGetAttachmentsHasAttachments

public void testGetAttachmentsHasAttachments()
                                      throws javax.mail.MessagingException,
                                             java.io.IOException
Throws:
javax.mail.MessagingException
java.io.IOException

testGetContentTypeFromHeaderValue

public void testGetContentTypeFromHeaderValue()

testGetContentTypeFromHeaderValueWithParameter

public void testGetContentTypeFromHeaderValueWithParameter()

testIsPlainTextPart

public void testIsPlainTextPart()
                         throws java.lang.Exception
Throws:
java.lang.Exception

testIsHtmlPart

public void testIsHtmlPart()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testIsImageAttachedPart

public void testIsImageAttachedPart()
                             throws java.lang.Exception
Throws:
java.lang.Exception

testIsInlineImagePart

public void testIsInlineImagePart()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testIsInlineImagePartWherePartHasDisposition

public void testIsInlineImagePartWherePartHasDisposition()
                                                  throws java.lang.Exception
Throws:
java.lang.Exception

testIsAttachmentPart

public void testIsAttachmentPart()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testIsRelatedPart

public void testIsRelatedPart()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testPositivePartIsSignature

public void testPositivePartIsSignature()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

testNegativePartIsSignature

public void testNegativePartIsSignature()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

testTextPartContentIsEmpty

public void testTextPartContentIsEmpty()
                                throws java.lang.Exception
Throws:
java.lang.Exception

testTextPartContentIsEmptyOnNullContent

public void testTextPartContentIsEmptyOnNullContent()
                                             throws java.lang.Exception
Throws:
java.lang.Exception

testTextPartContentIsEmptyBecauseContainsOnlyWhitespace

public void testTextPartContentIsEmptyBecauseContainsOnlyWhitespace()
                                                             throws java.lang.Exception
Throws:
java.lang.Exception

testBinaryAttachmentPartContentIsEmpty

public void testBinaryAttachmentPartContentIsEmpty()
                                            throws java.lang.Exception
Throws:
java.lang.Exception

testBinaryAttachmentPartContentIsNotEmpty

public void testBinaryAttachmentPartContentIsNotEmpty()
                                               throws java.lang.Exception
Throws:
java.lang.Exception

testInlineAttachment

public void testInlineAttachment()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testInlineAttachmentThatIsntBase64Encoded

public void testInlineAttachmentThatIsntBase64Encoded()
                                               throws java.lang.Exception
This test tests the oddf case where a part has a content-id but is not base64 encoded(aka binary) and therefore fails to be recognised as a probable inline part.

Throws:
java.lang.Exception


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.