Author: tn Date: Fri Mar 22 22:38:21 2013 New Revision: 1460036 URL: http://svn.apache.org/r1460036 Log: Migrate remaining tests to Junit 4 annotation style.
Added: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java - copied, changed from r1460018, commons/proper/email/trunk/src/test/java/org/apache/commons/mail/BaseEmailTestCase.java Removed: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/BaseEmailTestCase.java Modified: commons/proper/email/trunk/pom.xml commons/proper/email/trunk/src/test/java/org/apache/commons/mail/DefaultAuthenticatorTest.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailAttachmentTest.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailLiveTest.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailUtilsTest.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidAddressTest.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidInternetAddressTest.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SendWithAttachmentsTest.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SimpleEmailTest.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/util/MimeMessageParserTest.java Modified: commons/proper/email/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/pom.xml?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/pom.xml (original) +++ commons/proper/email/trunk/pom.xml Fri Mar 22 22:38:21 2013 @@ -293,7 +293,6 @@ <configuration> <!-- exclude test case support classes --> <excludes> - <exclude>org/apache/commons/mail/BaseEmailTestCase.java</exclude> <exclude>org/apache/commons/mail/mocks/*</exclude> <exclude>org/apache/commons/mail/settings/*</exclude> <exclude>**/Abstract*Test.java</exclude> Copied: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java (from r1460018, commons/proper/email/trunk/src/test/java/org/apache/commons/mail/BaseEmailTestCase.java) URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java?p2=commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java&p1=commons/proper/email/trunk/src/test/java/org/apache/commons/mail/BaseEmailTestCase.java&r1=1460018&r2=1460036&rev=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/BaseEmailTestCase.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/AbstractEmailTest.java Fri Mar 22 22:38:21 2013 @@ -17,6 +17,7 @@ package org.apache.commons.mail; import static org.easymock.EasyMock.expect; +import static org.junit.Assert.*; import static org.powermock.api.easymock.PowerMock.createMock; import static org.powermock.api.easymock.PowerMock.replay; @@ -36,9 +37,9 @@ import javax.mail.Multipart; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; -import junit.framework.TestCase; - import org.apache.commons.mail.settings.EmailConfiguration; +import org.junit.After; +import org.junit.Before; import org.subethamail.wiser.Wiser; import org.subethamail.wiser.WiserMessage; @@ -48,7 +49,7 @@ import org.subethamail.wiser.WiserMessag * @since 1.0 * @version $Id$ */ -public abstract class BaseEmailTestCase extends TestCase +public abstract class AbstractEmailTest { /** Padding at end of body added by wiser/send */ public static final int BODY_END_PAD = 3; @@ -107,9 +108,9 @@ public abstract class BaseEmailTestCase /** * @param name name */ - public BaseEmailTestCase(String name) + @Before + public void setUpAbstractEmailTest() { - super(name); emailOutputDir = new File("target/test-emails"); if (!emailOutputDir.exists()) { @@ -117,9 +118,8 @@ public abstract class BaseEmailTestCase } } - /** */ - @Override - protected void tearDown() + @After + public void tearDownEmailTest() { //stop the fake email server (if started) if (this.fakeMailServer != null && !isMailServerStopped(fakeMailServer)) @@ -345,9 +345,9 @@ public abstract class BaseEmailTestCase // and -- (front and end) String emailMessageBody = getMessageBody(emailMessage); String strMessageBody = - emailMessageBody.substring(BaseEmailTestCase.BODY_START_PAD, + emailMessageBody.substring(AbstractEmailTest.BODY_START_PAD, emailMessageBody.length() - - BaseEmailTestCase.BODY_END_PAD); + - AbstractEmailTest.BODY_END_PAD); assertTrue("didn't find expected content type in message body", strMessageBody.indexOf(strSentContent) != -1); } Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/DefaultAuthenticatorTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/DefaultAuthenticatorTest.java?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/DefaultAuthenticatorTest.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/DefaultAuthenticatorTest.java Fri Mar 22 22:38:21 2013 @@ -16,9 +16,11 @@ */ package org.apache.commons.mail; +import static org.junit.Assert.*; + import javax.mail.PasswordAuthentication; -import junit.framework.TestCase; +import org.junit.Test; /** * JUnit test case for DefaultAuthenticator Class. @@ -26,24 +28,15 @@ import junit.framework.TestCase; * @since 1.0 * @version $Id$ */ -public class DefaultAuthenticatorTest extends TestCase +public class DefaultAuthenticatorTest { - /** - * @param name name - */ - public DefaultAuthenticatorTest(String name) - { - super(name); - } - - /** */ + @Test public void testDefaultAuthenticatorConstructor() { //insert code testing basic functionality String strUsername = "user.name"; String strPassword = "user.pwd"; - DefaultAuthenticator authenicator = - new DefaultAuthenticator(strUsername, strPassword); + DefaultAuthenticator authenicator = new DefaultAuthenticator(strUsername, strPassword); assertTrue( PasswordAuthentication.class.isInstance( Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailAttachmentTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailAttachmentTest.java?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailAttachmentTest.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailAttachmentTest.java Fri Mar 22 22:38:21 2013 @@ -16,42 +16,34 @@ */ package org.apache.commons.mail; +import static org.junit.Assert.*; + import java.net.MalformedURLException; import java.net.URL; +import org.junit.Before; +import org.junit.Test; + /** * JUnit test case for EmailAttachment Class. * * @since 1.0 * @version $Id$ */ -public class EmailAttachmentTest extends BaseEmailTestCase +public class EmailAttachmentTest extends AbstractEmailTest { - /** */ private EmailAttachment attachment; - /** - * @param name name - */ - public EmailAttachmentTest(String name) - { - super(name); - } - - /** - * @throws Exception */ - @Override - protected void setUp() throws Exception + @Before + public void setUpAttachmentTest() { - super.setUp(); // reusable objects to be used across multiple tests this.attachment = new EmailAttachment(); } - /** */ + @Test public void testGetSetDescription() { - for (int i = 0; i < testCharsValid.length; i++) { this.attachment.setDescription(testCharsValid[i]); @@ -59,10 +51,9 @@ public class EmailAttachmentTest extends } } - /** */ + @Test public void testGetSetName() { - for (int i = 0; i < testCharsValid.length; i++) { this.attachment.setName(testCharsValid[i]); @@ -70,10 +61,9 @@ public class EmailAttachmentTest extends } } - /** */ + @Test public void testGetSetPath() { - for (int i = 0; i < testCharsValid.length; i++) { this.attachment.setPath(testCharsValid[i]); @@ -81,7 +71,7 @@ public class EmailAttachmentTest extends } } - /** */ + @Test public void testGetSetURL() { String[] tests = @@ -105,10 +95,9 @@ public class EmailAttachmentTest extends } } - /** */ + @Test public void testGetSetDisposition() { - for (int i = 0; i < testCharsValid.length; i++) { this.attachment.setDisposition(testCharsValid[i]); Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailLiveTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailLiveTest.java?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailLiveTest.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailLiveTest.java Fri Mar 22 22:38:21 2013 @@ -20,6 +20,8 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.mail.resolver.DataSourceUrlResolver; import org.apache.commons.mail.settings.EmailConfiguration; +import org.junit.Before; +import org.junit.Test; import javax.activation.DataSource; import javax.activation.URLDataSource; @@ -40,23 +42,11 @@ import java.util.List; * of email using a variety of mail clients since I'm not a mockist * (see http://martinfowler.com/articles/mocksArentStubs.html#ClassicalAndMockistTesting). */ -public class EmailLiveTest extends BaseEmailTestCase +public class EmailLiveTest extends AbstractEmailTest { - /** - * @param name name - */ - public EmailLiveTest(String name) + @Before + public void setUpLiveTest() { - super(name); - } - - /** - * @throws Exception */ - @Override - protected void setUp() throws Exception - { - super.setUp(); - // enforce a default charset UTF-8 otherwise non-ASCII attachment names will not work System.setProperty("mail.mime.charset", "utf-8"); @@ -124,6 +114,7 @@ public class EmailLiveTest extends BaseE * * @throws Exception the test failed */ + @Test public void testSimpleEmail() throws Exception { SimpleEmail email = (SimpleEmail) create(SimpleEmail.class); @@ -138,6 +129,7 @@ public class EmailLiveTest extends BaseE * * @throws Exception the test failed */ + @Test public void testFoldedHeaderValue() throws Exception { SimpleEmail email = (SimpleEmail) create(SimpleEmail.class); @@ -153,6 +145,7 @@ public class EmailLiveTest extends BaseE * * @throws Exception the test failed */ + @Test public void testMultiPartEmail() throws Exception { MultiPartEmail email = (MultiPartEmail) create(MultiPartEmail.class); @@ -170,6 +163,7 @@ public class EmailLiveTest extends BaseE * * @throws Exception the test failed */ + @Test public void testHtmlMailMimeLayout() throws Exception { String textMsg; @@ -251,6 +245,7 @@ public class EmailLiveTest extends BaseE * * @throws Exception the test failed */ + @Test public void testCorrectCharacterEncoding() throws Exception { // U+03B1 : GREEK SMALL LETTER ALPHA @@ -278,6 +273,7 @@ public class EmailLiveTest extends BaseE * * @throws Exception the test failed */ + @Test public void testImageHtmlEmailLocal() throws Exception { // use a simple HTML page with one image @@ -301,6 +297,7 @@ public class EmailLiveTest extends BaseE * * @throws Exception the test failed */ + @Test public void testImageHtmlEmailRemote() throws Exception { if(EmailConfiguration.MAIL_FORCE_SEND) @@ -328,6 +325,7 @@ public class EmailLiveTest extends BaseE * * @throws Exception the test failed. */ + @Test public void testSendingEmailsInBatch() throws Exception { List<SimpleEmail> emails = new ArrayList<SimpleEmail>(); 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=1460036&r1=1460035&r2=1460036&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 Fri Mar 22 22:38:21 2013 @@ -16,6 +16,8 @@ */ package org.apache.commons.mail; +import static org.junit.Assert.*; + import java.io.File; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; @@ -37,6 +39,8 @@ import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import javax.mail.internet.ParseException; import org.apache.commons.mail.mocks.MockEmailConcrete; +import org.junit.Before; +import org.junit.Test; /** * JUnit test case for Email Class @@ -44,37 +48,27 @@ import org.apache.commons.mail.mocks.Moc * @since 1.0 * @version $Id$ */ -public class EmailTest extends BaseEmailTestCase +public class EmailTest extends AbstractEmailTest { /** valid email addresses */ public static final String[] ARR_VALID_EMAILS = { "m...@home.com", "joe....@apache.org", - "someone_h...@work-address.com.au"}; + "someone_h...@work-address.com.au" + }; /** mock for testing */ private MockEmailConcrete email; - /** - * @param name test name - */ - public EmailTest(String name) + @Before + public void setUpEmailTest() { - super(name); - } - - /** - * @throws Exception */ - @Override - protected void setUp() throws Exception - { - super.setUp(); // reusable objects to be used across multiple tests this.email = new MockEmailConcrete(); } - /** */ + @Test public void testGetSetDebug() { // JUnitDoclet begin method setBoolTest isBoolTest @@ -87,10 +81,7 @@ public class EmailTest extends BaseEmail } } - /** - * - * @throws Exception Exception - */ + @Test public void testGetSetSession() throws Exception { @@ -110,7 +101,7 @@ public class EmailTest extends BaseEmail } - /** */ + @Test public void testGetSetAuthentication() { // setup @@ -134,7 +125,7 @@ public class EmailTest extends BaseEmail retrievedAuth.getPasswordAuthentication().getPassword()); } - /** */ + @Test public void testGetSetAuthenticator() { // setup @@ -160,7 +151,7 @@ public class EmailTest extends BaseEmail retrievedAuth.getPasswordAuthentication().getPassword()); } - /** */ + @Test public void testGetSetCharset() { // test ASCII and UTF-8 charsets; since every JVM is required @@ -174,7 +165,7 @@ public class EmailTest extends BaseEmail assertEquals(set.name(), this.email.getCharset()); } - /** */ + @Test public void testSetContentMimeMultipart() { MimeMultipart[] tests = @@ -187,7 +178,7 @@ public class EmailTest extends BaseEmail } } - /** */ + @Test public void testSetContentObject() { // setup @@ -231,7 +222,7 @@ public class EmailTest extends BaseEmail assertEquals(testContentType, this.email.getContentType()); } - /** */ + @Test public void testGetSetHostName() { @@ -242,7 +233,7 @@ public class EmailTest extends BaseEmail } } - /** */ + @Test public void testGetSetSmtpPort() { // ==================================================================== @@ -278,10 +269,7 @@ public class EmailTest extends BaseEmail } - /** - * - * @throws Exception Exception - */ + @Test public void testSetFrom() throws Exception { // ==================================================================== @@ -310,10 +298,7 @@ public class EmailTest extends BaseEmail } } - /** - * - * @throws Exception Exception - */ + @Test public void testSetFromWithEncoding() throws Exception { // ==================================================================== @@ -332,10 +317,7 @@ public class EmailTest extends BaseEmail } - /** - * - * @throws Exception Exception - */ + @Test public void testSetFrom2() throws Exception { // ==================================================================== @@ -392,6 +374,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddTo() throws EmailException, AddressException, UnsupportedEncodingException { // ==================================================================== @@ -418,6 +401,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddToArray() throws EmailException, AddressException, UnsupportedEncodingException { // ==================================================================== @@ -441,6 +425,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddToWithEncoding() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -473,6 +458,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddTo2() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -519,6 +505,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testSetTo() throws UnsupportedEncodingException, EmailException { // ==================================================================== @@ -574,6 +561,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddCc() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -600,6 +588,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddCcArray() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -623,6 +612,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddCcWithEncoding() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -652,6 +642,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddCc2() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -697,6 +688,7 @@ public class EmailTest extends BaseEmail /** * @throws EmailException when there are problems adding an address */ + @Test public void testSetCc() throws EmailException, AddressException { // ==================================================================== @@ -742,6 +734,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddBcc() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -770,6 +763,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddBccArray() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -795,6 +789,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddBccWithEncoding() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -825,6 +820,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddBcc2() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -874,6 +870,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testSetBcc() throws UnsupportedEncodingException, EmailException { // ==================================================================== @@ -924,6 +921,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddReplyTo() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -952,6 +950,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddReplyToWithEncoding() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -982,6 +981,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testAddReplyTo2() throws UnsupportedEncodingException, AddressException, EmailException { // ==================================================================== @@ -1026,7 +1026,7 @@ public class EmailTest extends BaseEmail } } - /** */ + @Test public void testAddHeader() { // ==================================================================== @@ -1049,7 +1049,7 @@ public class EmailTest extends BaseEmail assertEquals(ht, this.email.getHeaders()); } - /** */ + @Test public void testAddHeaderEx() { // ==================================================================== @@ -1084,7 +1084,7 @@ public class EmailTest extends BaseEmail this.email.getHeaders().toString()); } - /** */ + @Test public void testSetHeaders() { Map<String, String> ht = new Hashtable<String, String>(); @@ -1098,6 +1098,7 @@ public class EmailTest extends BaseEmail assertEquals(ht, this.email.getHeaders()); } + @Test public void testFoldingHeaders() throws Exception { this.email.setHostName(this.strTestMailServer); @@ -1129,7 +1130,7 @@ public class EmailTest extends BaseEmail assertTrue(values[0].indexOf("\n") == values[0].lastIndexOf("\n")); } - /** */ + @Test public void testSetHeadersEx() { // ==================================================================== @@ -1177,7 +1178,7 @@ public class EmailTest extends BaseEmail this.email.getHeaders().toString()); } - /** */ + @Test public void testSetSubject() { @@ -1188,7 +1189,7 @@ public class EmailTest extends BaseEmail } } - /** */ + @Test public void testSendEx() { // ==================================================================== @@ -1320,7 +1321,7 @@ public class EmailTest extends BaseEmail } - /** */ + @Test public void testGetSetSentDate() { // with input date @@ -1345,6 +1346,7 @@ public class EmailTest extends BaseEmail * @throws EmailException when there are problems adding an address * @throws UnsupportedEncodingException on bad email addresses */ + @Test public void testToInternetAddressArray() throws EmailException, UnsupportedEncodingException { List<InternetAddress> testInetEmailValid = new ArrayList<InternetAddress>(); @@ -1365,7 +1367,7 @@ public class EmailTest extends BaseEmail this.email.getBccAddresses().size()); } - /** */ + @Test public void testSetPopBeforeSmtp() { // simple test (can be improved) @@ -1399,6 +1401,7 @@ public class EmailTest extends BaseEmail * to the content type of a text/based content object. * @throws Exception on any error */ + @Test public void testDefaultCharsetAppliesToTextContent() throws Exception { this.email.setHostName(this.strTestMailServer); @@ -1421,6 +1424,7 @@ public class EmailTest extends BaseEmail * charset in setContent(). * @throws Exception on any error */ + @Test public void testDefaultCharsetCanBeOverriddenByContentType() throws Exception { @@ -1443,6 +1447,7 @@ public class EmailTest extends BaseEmail * A non-text content object ignores a default charset entirely. * @throws Exception on any error */ + @Test public void testDefaultCharsetIgnoredByNonTextContent() throws Exception { @@ -1460,6 +1465,7 @@ public class EmailTest extends BaseEmail assertEquals("application/octet-stream", msg.getContentType()); } + @Test public void testCorrectContentTypeForPNG() throws Exception { this.email.setHostName(this.strTestMailServer); Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailUtilsTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailUtilsTest.java?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailUtilsTest.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailUtilsTest.java Fri Mar 22 22:38:21 2013 @@ -17,9 +17,11 @@ package org.apache.commons.mail; +import static org.junit.Assert.assertEquals; + import java.io.UnsupportedEncodingException; -import junit.framework.TestCase; +import org.junit.Test; /** * JUnit test case for EmailUtils Class @@ -27,17 +29,9 @@ import junit.framework.TestCase; * @since 1.3 * @version $Id$ */ -public class EmailUtilsTest extends TestCase +public class EmailUtilsTest { - - /** - * @param name name - */ - public EmailUtilsTest(String name) - { - super(name); - } - + @Test public void testUrlEncoding() throws UnsupportedEncodingException { assertEquals("abcdefg", EmailUtils.encodeUrl("abcdefg")); Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java Fri Mar 22 22:38:21 2013 @@ -16,6 +16,8 @@ */ package org.apache.commons.mail; +import static org.junit.Assert.*; + import java.io.File; import java.io.IOException; import java.net.URL; @@ -29,6 +31,8 @@ import org.apache.commons.mail.mocks.Moc import org.apache.commons.mail.settings.EmailConfiguration; import org.apache.commons.mail.util.MimeMessageParser; +import org.junit.Before; +import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @@ -41,27 +45,18 @@ import org.powermock.modules.junit4.Powe */ @RunWith(PowerMockRunner.class) @PrepareForTest( { MockHtmlEmailConcrete.class }) -public class HtmlEmailTest extends BaseEmailTestCase +public class HtmlEmailTest extends AbstractEmailTest { - /** */ private MockHtmlEmailConcrete email; - /** - * @param name name - */ - public HtmlEmailTest(String name) + @Before + public void setUpHtmlEmailTest() { - super(name); - } - - @Override - protected void setUp() throws Exception - { - super.setUp(); // reusable objects to be used across multiple tests this.email = new MockHtmlEmailConcrete(); } + @Test public void testGetSetTextMsg() throws EmailException { // ==================================================================== @@ -91,6 +86,7 @@ public class HtmlEmailTest extends BaseE } + @Test public void testGetSetHtmlMsg() throws EmailException { // ==================================================================== @@ -120,6 +116,7 @@ public class HtmlEmailTest extends BaseE } + @Test public void testGetSetMsg() throws EmailException { // ==================================================================== @@ -152,6 +149,7 @@ public class HtmlEmailTest extends BaseE } + @Test public void testEmbedUrl() throws Exception { // ==================================================================== @@ -203,6 +201,7 @@ public class HtmlEmailTest extends BaseE } } + @Test public void testEmbedFile() throws Exception { // ==================================================================== @@ -231,6 +230,7 @@ public class HtmlEmailTest extends BaseE strEmbed.equals(newCid)); } + @Test public void testEmbedUrlAndFile() throws Exception { File tmpFile = File.createTempFile("testfile", "txt"); @@ -244,6 +244,7 @@ public class HtmlEmailTest extends BaseE fileCid.equals(urlCid)); } + @Test public void testEmbedDataSource() throws Exception { File tmpFile = File.createTempFile("testEmbedDataSource", "txt"); @@ -288,6 +289,7 @@ public class HtmlEmailTest extends BaseE * @throws EmailException when bad addresses and attachments are used * @throws IOException if creating a temp file, URL or sending fails */ + @Test public void testSend() throws EmailException, IOException { EmailAttachment attachment = new EmailAttachment(); @@ -399,6 +401,7 @@ public class HtmlEmailTest extends BaseE true); } + @Test public void testSend2() throws Exception { // ==================================================================== @@ -500,6 +503,7 @@ public class HtmlEmailTest extends BaseE * "http://paradisedelivery.homeip.net/delivery/?file=TZC268X93337..zip" * contains TWO dots instead of one dot which breaks the link. */ + @Test public void testAddZipUrl() throws Exception { String htmlMsg = @@ -552,6 +556,7 @@ public class HtmlEmailTest extends BaseE * causes duplicate mime parts - now we throw an exception to catch the * problem */ + @Test public void testCallingBuildMimeMessageBeforeSent() throws Exception { String htmlMsg = "<b>Hello World</b>"; @@ -593,6 +598,7 @@ public class HtmlEmailTest extends BaseE * EMAIL-73 - check that providing a plain text content using setMsg() * creates a plain content and HTML content using <pre> tags. */ + @Test public void testSendWithPlainTextButNoHtmlContent() throws EmailException, IOException { this.getMailServer(); @@ -634,6 +640,7 @@ public class HtmlEmailTest extends BaseE * * see https://issues.apache.org/jira/browse/EMAIL-101 */ + @Test public void testEmbedFileWithCID() throws Exception { // ==================================================================== @@ -655,8 +662,9 @@ public class HtmlEmailTest extends BaseE // back? String returnedCid = this.email.embed(file); assertEquals("didn't get same CID after embedding same file twice", encodedCid, returnedCid); - } + } + @Test public void testHtmlMailMimeLayout() throws Exception { assertCorrectContentType("contentTypeTest.gif", "image/gif"); Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java Fri Mar 22 22:38:21 2013 @@ -16,6 +16,8 @@ */ package org.apache.commons.mail; +import static org.junit.Assert.*; + import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.mail.resolver.DataSourceClassPathResolver; @@ -24,6 +26,9 @@ import org.apache.commons.mail.resolver. import org.apache.commons.mail.mocks.MockImageHtmlEmailConcrete; import org.apache.commons.mail.util.MimeMessageParser; import org.apache.commons.mail.util.MimeMessageUtils; +import org.junit.Before; +import org.junit.Test; + import javax.mail.internet.MimeMessage; import java.io.File; import java.io.IOException; @@ -45,13 +50,8 @@ public class ImageHtmlEmailTest extends private MockImageHtmlEmailConcrete email; - public ImageHtmlEmailTest(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); + @Before + public void setupImageHtmlEmailTest() { // reusable objects to be used across multiple tests email = new MockImageHtmlEmailConcrete(); } @@ -60,6 +60,7 @@ public class ImageHtmlEmailTest extends // Start of Tests // ====================================================================== + @Test public void testSendHtml() throws Exception { Logger.getLogger(ImageHtmlEmail.class.getName()).setLevel(Level.FINEST); @@ -98,6 +99,7 @@ public class ImageHtmlEmailTest extends assertTrue(mimeMessageParser.getAttachmentList().size() == 3); } + @Test public void testSendEmptyHTML() throws Exception { Logger.getLogger(ImageHtmlEmail.class.getName()).setLevel(Level.FINEST); @@ -114,6 +116,7 @@ public class ImageHtmlEmailTest extends } } + @Test public void testSendEmptyHTML2() throws Exception { Logger.getLogger(ImageHtmlEmail.class.getName()).setLevel(Level.FINEST); @@ -131,6 +134,7 @@ public class ImageHtmlEmailTest extends } + @Test public void testSendHtmlUrl() throws Exception { Logger.getLogger(ImageHtmlEmail.class.getName()).setLevel(Level.FINEST); @@ -162,6 +166,7 @@ public class ImageHtmlEmailTest extends email.getCcAddresses(), email.getBccAddresses(), true); } + @Test public void testSendHTMLAbsoluteLocalFile() throws Exception { Logger.getLogger(ImageHtmlEmail.class.getName()).setLevel(Level.FINEST); @@ -198,6 +203,7 @@ public class ImageHtmlEmailTest extends email.getCcAddresses(), email.getBccAddresses(), true); } + @Test public void testSendHTMLClassPathFile() throws Exception { Logger.getLogger(ImageHtmlEmail.class.getName()).setLevel(Level.FINEST); @@ -236,6 +242,7 @@ public class ImageHtmlEmailTest extends assertTrue(mimeMessageParser.getAttachmentList().size() == 1); } + @Test public void testSendHTMLAutoResolveFile() throws Exception { Logger.getLogger(ImageHtmlEmail.class.getName()).setLevel(Level.FINEST); @@ -278,6 +285,7 @@ public class ImageHtmlEmailTest extends assertTrue(mimeMessageParser.getAttachmentList().size() == 1); } + @Test public void testSendHTMLAutoResolveMultipleFiles() throws Exception { Logger.getLogger(ImageHtmlEmail.class.getName()).setLevel(Level.FINEST); @@ -320,6 +328,7 @@ public class ImageHtmlEmailTest extends assertTrue(mimeMessageParser.getAttachmentList().size() == 3); } + @Test public void testRegex() { Pattern pattern = Pattern.compile(ImageHtmlEmail.REGEX_IMG_SRC); Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidAddressTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidAddressTest.java?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidAddressTest.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidAddressTest.java Fri Mar 22 22:38:21 2013 @@ -16,7 +16,11 @@ */ package org.apache.commons.mail; +import static org.junit.Assert.fail; + import org.apache.commons.mail.mocks.MockEmailConcrete; +import org.junit.Before; +import org.junit.Test; /** * JUnit test case for invalid Addresses in Email Class @@ -24,7 +28,7 @@ import org.apache.commons.mail.mocks.Moc * @since 1.0 * @version $Id$ */ -public class InvalidAddressTest extends BaseEmailTestCase +public class InvalidAddressTest extends AbstractEmailTest { /** */ private static final String [] ARR_INVALID_EMAILS = { @@ -62,32 +66,16 @@ public class InvalidAddressTest extends "@domain.com" }; - /** */ private MockEmailConcrete email; - /** - * @param name name - */ - public InvalidAddressTest(String name) - { - super(name); - } - - /** - * @throws Exception */ - @Override - protected void setUp() throws Exception + @Before + public void setUpInvalidAddressTest() { - super.setUp(); - // reusable objects to be used across multiple tests this.email = new MockEmailConcrete(); } - /** - * - * @throws Exception Exception - */ + @Test public void testSetInvalidFrom() throws Exception { @@ -111,10 +99,7 @@ public class InvalidAddressTest extends } } - /** - * - * @throws Exception Exception - */ + @Test public void testAddInvalidTo() throws Exception { @@ -138,10 +123,7 @@ public class InvalidAddressTest extends } } - /** - * - * @throws Exception Exception - */ + @Test public void testAddInvalidCc() throws Exception { @@ -165,10 +147,7 @@ public class InvalidAddressTest extends } } - /** - * - * @throws Exception Exception - */ + @Test public void testAddInvalidBcc() throws Exception { Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidInternetAddressTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidInternetAddressTest.java?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidInternetAddressTest.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/InvalidInternetAddressTest.java Fri Mar 22 22:38:21 2013 @@ -16,19 +16,24 @@ */ package org.apache.commons.mail; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import java.lang.reflect.Method; import javax.mail.internet.InternetAddress; +import org.junit.Before; +import org.junit.Test; + /** * JUnit test case demonstrating InternetAddress validation. * * @since 1.0 * @version $Id$ */ -public class InvalidInternetAddressTest extends BaseEmailTestCase +public class InvalidInternetAddressTest extends AbstractEmailTest { - /** */ private static final String VALID_QUOTED_EMAIL = "\"John O'Groats\"@domain.com"; @@ -69,23 +74,14 @@ public class InvalidInternetAddressTest "local.name@domain\rcom", "local.name@", "@domain.com" }; - /** - * @param name name - */ - public InvalidInternetAddressTest(String name) - { - super(name); - } /** * Setup for a test * @throws Exception on any error */ - @Override - protected void setUp() throws Exception + @Before + public void setUpInvalidInternetAddressTest() { - super.setUp(); - try { validateMethod = InternetAddress.class.getMethod("validate", new Class [0]); @@ -96,10 +92,7 @@ public class InvalidInternetAddressTest } } - /** - * - * @throws Exception Exception - */ + @Test public void testStrictConstructor() throws Exception { // ==================================================================== @@ -141,10 +134,7 @@ public class InvalidInternetAddressTest } } - /** - * - * @throws Exception Exception - */ + @Test public void testValidateMethod() throws Exception { if (validateMethod == null) @@ -198,10 +188,7 @@ public class InvalidInternetAddressTest } } - /** - * - * @throws Exception Exception - */ + @Test public void testValidateMethodCharset() throws Exception { if (validateMethod == null) Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java Fri Mar 22 22:38:21 2013 @@ -16,6 +16,8 @@ */ package org.apache.commons.mail; +import static org.junit.Assert.*; + import java.io.File; import java.io.IOException; import java.net.MalformedURLException; @@ -28,6 +30,8 @@ import javax.activation.URLDataSource; import javax.mail.internet.MimeMultipart; import org.apache.commons.mail.mocks.MockMultiPartEmailConcrete; +import org.junit.Before; +import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @@ -40,34 +44,22 @@ import org.powermock.modules.junit4.Powe */ @RunWith(PowerMockRunner.class) @PrepareForTest( { MockMultiPartEmailConcrete.class, URLDataSource.class }) -public class MultiPartEmailTest extends BaseEmailTestCase +public class MultiPartEmailTest extends AbstractEmailTest { /** */ private MockMultiPartEmailConcrete email; /** File to used to test file attachments (Must be valid) */ private File testFile; - /** - * @param name name - */ - public MultiPartEmailTest(String name) - { - super(name); - } - - /** - * @throws Exception */ - @Override - protected void setUp() throws Exception + @Before + public void setUpMultiPartEmailTest() throws Exception { - super.setUp(); // reusable objects to be used across multiple tests this.email = new MockMultiPartEmailConcrete(); testFile = File.createTempFile("testfile", ".txt"); } - /** - * @throws EmailException */ + @Test public void testSetMsg() throws EmailException { // ==================================================================== @@ -110,6 +102,7 @@ public class MultiPartEmailTest extends * @throws EmailException when a bad address or attachment is used * @throws IOException when sending fails */ + @Test public void testSend() throws EmailException, IOException { // ==================================================================== @@ -198,6 +191,7 @@ public class MultiPartEmailTest extends * @throws MalformedURLException when a bad attachment URL is used * @throws EmailException when a bad address or attachment is used */ + @Test public void testAttach() throws MalformedURLException, EmailException, Exception { EmailAttachment attachment; @@ -272,6 +266,7 @@ public class MultiPartEmailTest extends * @throws MalformedURLException when a bad attachment URL is used * @throws EmailException when a bad address or attachment is used */ + @Test public void testAttach2() throws MalformedURLException, EmailException { // ==================================================================== @@ -293,6 +288,7 @@ public class MultiPartEmailTest extends * @throws MalformedURLException when a bad attachment URL is used * @throws EmailException when a bad address or attachment is used */ + @Test public void testAttach3() throws MalformedURLException, EmailException, Exception { // ==================================================================== @@ -331,6 +327,7 @@ public class MultiPartEmailTest extends } } + @Test public void testAttachFileLocking() throws Exception { // ==================================================================== @@ -348,10 +345,7 @@ public class MultiPartEmailTest extends assertTrue(tmpFile.delete()); } - /** - * - * @throws Exception Exception - */ + @Test public void testAddPart() throws Exception { @@ -374,10 +368,7 @@ public class MultiPartEmailTest extends } - /** - * - * @throws Exception Exception - */ + @Test public void testAddPart2() throws Exception { @@ -402,12 +393,14 @@ public class MultiPartEmailTest extends } /** @todo implement test for GetContainer */ + @Test public void testGetContainer() { assertTrue(true); } /** init called twice should fail */ + @Test public void testInit() { // call the init function twice to trigger the IllegalStateException @@ -424,6 +417,7 @@ public class MultiPartEmailTest extends } /** test get/set sub type */ + @Test public void testGetSetSubType() { for (int i = 0; i < testCharsValid.length; i++) Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SendWithAttachmentsTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SendWithAttachmentsTest.java?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SendWithAttachmentsTest.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SendWithAttachmentsTest.java Fri Mar 22 22:38:21 2013 @@ -22,6 +22,8 @@ import java.net.URL; import org.apache.commons.mail.mocks.MockHtmlEmailConcrete; import org.apache.commons.mail.settings.EmailConfiguration; +import org.junit.Before; +import org.junit.Test; /** * JUnit test case verifying bugzilla issue 30973 is fixed. @@ -29,25 +31,13 @@ import org.apache.commons.mail.settings. * @since 1.0 * @version $Id$ */ -public class SendWithAttachmentsTest extends BaseEmailTestCase +public class SendWithAttachmentsTest extends AbstractEmailTest { - /** */ private MockHtmlEmailConcrete email; - /** - * @param name name - */ - public SendWithAttachmentsTest(String name) - { - super(name); - } - - /** - * @throws Exception */ - @Override - protected void setUp() throws Exception + @Before + public void setUpSendWithAttachmentsTest() { - super.setUp(); // reusable objects to be used across multiple tests this.email = new MockHtmlEmailConcrete(); } @@ -56,6 +46,7 @@ public class SendWithAttachmentsTest ext * @throws EmailException on an email error * @throws IOException when sending fails, or a bad URL is used */ + @Test public void testSendNoAttachments() throws EmailException, IOException { this.getMailServer(); @@ -113,6 +104,7 @@ public class SendWithAttachmentsTest ext * @throws EmailException on an email error * @throws IOException when sending fails, or a bad URL is used */ + @Test public void testSendWAttachments() throws EmailException, IOException { EmailAttachment attachment = new EmailAttachment(); Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SimpleEmailTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SimpleEmailTest.java?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SimpleEmailTest.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SimpleEmailTest.java Fri Mar 22 22:38:21 2013 @@ -16,40 +16,33 @@ */ package org.apache.commons.mail; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.io.IOException; import org.apache.commons.mail.mocks.MockSimpleEmail; +import org.junit.Before; +import org.junit.Test; /** * JUnit test case for SimpleEmailTest * @since 1.0 * @version $Id$ */ -public class SimpleEmailTest extends BaseEmailTestCase +public class SimpleEmailTest extends AbstractEmailTest { - /** */ private MockSimpleEmail email; - /** - * @param name name - */ - public SimpleEmailTest(String name) - { - super(name); - } - - /** - * @throws Exception */ - @Override - protected void setUp() throws Exception + @Before + public void setUpSimpleEmailTest() { - super.setUp(); // reusable objects to be used across multiple tests this.email = new MockSimpleEmail(); } - /** - * @throws EmailException */ + @Test public void testGetSetMsg() throws EmailException { // ==================================================================== @@ -84,6 +77,7 @@ public class SimpleEmailTest extends Bas * @throws IOException when sending fails * @todo Add code to test the popBeforeSmtp() settings */ + @Test public void testSend() throws EmailException, IOException { // ==================================================================== Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/util/MimeMessageParserTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/util/MimeMessageParserTest.java?rev=1460036&r1=1460035&r2=1460036&view=diff ============================================================================== --- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/util/MimeMessageParserTest.java (original) +++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/util/MimeMessageParserTest.java Fri Mar 22 22:38:21 2013 @@ -16,11 +16,14 @@ */ package org.apache.commons.mail.util; -import junit.framework.TestCase; +import static org.junit.Assert.*; import javax.activation.DataSource; import javax.mail.Session; import javax.mail.internet.MimeMessage; + +import org.junit.Test; + import java.io.File; import java.util.List; import java.util.Properties; @@ -29,22 +32,8 @@ import java.util.Properties; * Testing the MimeMessageParser. */ public class MimeMessageParserTest - extends TestCase { - /** - * Defines the test case name for JUnit. - * - * @param name the test case's name. - */ - public MimeMessageParserTest(String name) - { - super(name); - } - - // ====================================================================== - // Start of Tests - // ====================================================================== - + @Test public void testParseSimpleEmail() throws Exception { Session session = Session.getDefaultInstance(new Properties()); @@ -68,6 +57,7 @@ public class MimeMessageParserTest assertFalse(mimeMessageParser.hasAttachments()); } + @Test public void testParseSimpleReplyEmail() throws Exception { Session session = Session.getDefaultInstance(new Properties()); @@ -91,6 +81,7 @@ public class MimeMessageParserTest assertFalse(mimeMessageParser.hasAttachments()); } + @Test public void testParseHtmlEmailWithAttachments() throws Exception { DataSource dataSource; @@ -131,6 +122,7 @@ public class MimeMessageParserTest * * @throws Exception the test failed */ + @Test public void testParseMultipartReport() throws Exception { DataSource dataSource; @@ -168,6 +160,7 @@ public class MimeMessageParserTest * * @throws Exception the test failed */ + @Test public void testAttachmentOnly() throws Exception { DataSource dataSource; @@ -205,6 +198,7 @@ public class MimeMessageParserTest * * @throws Exception the test failed */ + @Test public void testParseNoHeaderSeperatorWithOutOfMemory() throws Exception { Session session = Session.getDefaultInstance(new Properties());