james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ieu...@apache.org
Subject svn commit: r1426193 [6/7] - in /james/mime4j/trunk: ./ core/src/test/java/org/apache/james/mime4j/ core/src/test/java/org/apache/james/mime4j/codec/ core/src/test/java/org/apache/james/mime4j/io/ core/src/test/java/org/apache/james/mime4j/parser/ core...
Date Thu, 27 Dec 2012 13:23:56 GMT
Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientDateTimeFieldTest.java Thu Dec 27 13:23:54 2012
@@ -19,18 +19,18 @@
 
 package org.apache.james.mime4j.field;
 
-import java.util.Date;
-
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.dom.field.DateTimeField;
 import org.apache.james.mime4j.stream.RawField;
 import org.apache.james.mime4j.stream.RawFieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 import org.apache.james.mime4j.util.ContentUtil;
+import org.junit.Assert;
+import org.junit.Test;
 
-import junit.framework.TestCase;
+import java.util.Date;
 
-public class LenientDateTimeFieldTest extends TestCase {
+public class LenientDateTimeFieldTest {
 
     static DateTimeField parse(final String s) throws MimeException {
         ByteSequence raw = ContentUtil.encode(s);
@@ -38,24 +38,28 @@ public class LenientDateTimeFieldTest ex
         return DateTimeFieldLenientImpl.PARSER.parse(rawField, null);
     }
 
-    public void testDateDST() throws Exception  {
+    @Test
+    public void testDateDST() throws Exception {
         DateTimeField f = parse("Date: Wed, 16 Jul 2008 17:12:33 +0200");
-        assertEquals(new Date(1216221153000L), f.getDate());
+        Assert.assertEquals(new Date(1216221153000L), f.getDate());
     }
 
-    public void testDateDSTNoDayOfWeek() throws Exception  {
+    @Test
+    public void testDateDSTNoDayOfWeek() throws Exception {
         DateTimeField f = parse("Date: 16 Jul 2008 17:12:33 +0200");
-        assertEquals(new Date(1216221153000L), f.getDate());
+        Assert.assertEquals(new Date(1216221153000L), f.getDate());
     }
-    
+
+    @Test
     public void testdd() throws Exception {
         DateTimeField f = parse("Date: Thu, 01 Jan 1970 12:00:00 +0000");
-        assertEquals(43200000L, f.getDate().getTime());
+        Assert.assertEquals(43200000L, f.getDate().getTime());
     }
 
+    @Test
     public void testMime4j219() throws Exception {
         DateTimeField f = parse("Date: Tue, 17 Jul 2012 22:23:35.882 0000");
-        assertEquals(1342563815882L,f.getDate().getTime());
+        Assert.assertEquals(1342563815882L, f.getDate().getTime());
     }
 
 }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientMimeVersionParserTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientMimeVersionParserTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientMimeVersionParserTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/LenientMimeVersionParserTest.java Thu Dec 27 13:23:54 2012
@@ -19,16 +19,17 @@
 
 package org.apache.james.mime4j.field;
 
-import junit.framework.TestCase;
-
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.dom.field.MimeVersionField;
 import org.apache.james.mime4j.stream.RawField;
 import org.apache.james.mime4j.stream.RawFieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 import org.apache.james.mime4j.util.ContentUtil;
+import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
 
-public class LenientMimeVersionParserTest extends TestCase {
+public class LenientMimeVersionParserTest {
 
     static MimeVersionField parse(final String s) throws MimeException {
         ByteSequence raw = ContentUtil.encode(s);
@@ -42,6 +43,7 @@ public class LenientMimeVersionParserTes
         assertEquals("Minor version number", expectedMinorVersion, f.getMinorVersion());
     }
 
+    @Test
     public void testPlainLine() throws Exception {
         check("2.4", 2, 4);
         check("25.344", 25, 344);
@@ -49,6 +51,7 @@ public class LenientMimeVersionParserTes
         check("123234234.0", 123234234, 0);
     }
 
+    @Test
     public void testLineWithComments() throws Exception {
         check("2(A comment).4", 2, 4);
         check("2(.8).4", 2, 4);
@@ -57,36 +60,41 @@ public class LenientMimeVersionParserTes
         check("2.(A comment)4", 2, 4);
     }
 
+    @Test
     public void testLineWithNestedComments() throws Exception {
         check("2(4.45 ( Another ()comment () blah (Wobble(mix)))Whatever).4", 2, 4);
     }
 
+    @Test
     public void testMalformed1() throws Exception {
         MimeVersionField f = parse("MIME-Version: 5  ");
-        assertEquals(5, f.getMajorVersion());
-        assertEquals(MimeVersionFieldImpl.DEFAULT_MINOR_VERSION, f.getMinorVersion());
-        assertNull(f.getParseException());
+        Assert.assertEquals(5, f.getMajorVersion());
+        Assert.assertEquals(MimeVersionFieldImpl.DEFAULT_MINOR_VERSION, f.getMinorVersion());
+        Assert.assertNull(f.getParseException());
     }
 
+    @Test
     public void testMalformed2() throws Exception {
         MimeVersionField f = parse("MIME-Version: 5.  ");
-        assertEquals(5, f.getMajorVersion());
-        assertEquals(MimeVersionFieldImpl.DEFAULT_MINOR_VERSION, f.getMinorVersion());
-        assertNull(f.getParseException());
+        Assert.assertEquals(5, f.getMajorVersion());
+        Assert.assertEquals(MimeVersionFieldImpl.DEFAULT_MINOR_VERSION, f.getMinorVersion());
+        Assert.assertNull(f.getParseException());
     }
 
+    @Test
     public void testMalformed3() throws Exception {
         MimeVersionField f = parse("MIME-Version: .5  ");
-        assertEquals(MimeVersionFieldImpl.DEFAULT_MAJOR_VERSION, f.getMajorVersion());
-        assertEquals(5, f.getMinorVersion());
-        assertNull(f.getParseException());
+        Assert.assertEquals(MimeVersionFieldImpl.DEFAULT_MAJOR_VERSION, f.getMajorVersion());
+        Assert.assertEquals(5, f.getMinorVersion());
+        Assert.assertNull(f.getParseException());
     }
 
+    @Test
     public void testMalformed4() throws Exception {
         MimeVersionField f = parse("MIME-Version: crap ");
-        assertEquals(MimeVersionFieldImpl.DEFAULT_MAJOR_VERSION, f.getMajorVersion());
-        assertEquals(MimeVersionFieldImpl.DEFAULT_MINOR_VERSION, f.getMinorVersion());
-        assertNull(f.getParseException());
+        Assert.assertEquals(MimeVersionFieldImpl.DEFAULT_MAJOR_VERSION, f.getMajorVersion());
+        Assert.assertEquals(MimeVersionFieldImpl.DEFAULT_MINOR_VERSION, f.getMinorVersion());
+        Assert.assertNull(f.getParseException());
     }
 
 }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/MimeVersionParserTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/MimeVersionParserTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/MimeVersionParserTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/MimeVersionParserTest.java Thu Dec 27 13:23:54 2012
@@ -19,16 +19,17 @@
 
 package org.apache.james.mime4j.field;
 
-import junit.framework.TestCase;
-
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.dom.field.MimeVersionField;
 import org.apache.james.mime4j.stream.RawField;
 import org.apache.james.mime4j.stream.RawFieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 import org.apache.james.mime4j.util.ContentUtil;
+import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
 
-public class MimeVersionParserTest extends TestCase {
+public class MimeVersionParserTest {
 
     static MimeVersionField parse(final String s) throws MimeException {
         ByteSequence raw = ContentUtil.encode(s);
@@ -42,6 +43,7 @@ public class MimeVersionParserTest exten
         assertEquals("Minor version number", expectedMinorVersion, f.getMinorVersion());
     }
 
+    @Test
     public void testPlainLine() throws Exception {
         check("2.4", 2, 4);
         check("25.344", 25, 344);
@@ -49,6 +51,7 @@ public class MimeVersionParserTest exten
         check("123234234.0", 123234234, 0);
     }
 
+    @Test
     public void testLineWithComments() throws Exception {
         check("2(A comment).4", 2, 4);
         check("2(.8).4", 2, 4);
@@ -57,15 +60,17 @@ public class MimeVersionParserTest exten
         check("2.(A comment)4", 2, 4);
     }
 
+    @Test
     public void testLineWithNestedComments() throws Exception {
         check("2(4.45 ( Another ()comment () blah (Wobble(mix)))Whatever).4", 2, 4);
     }
 
+    @Test
     public void testEmptyLine() throws Exception {
         MimeVersionField f = parse("MIME-Version: (This is just a comment)");
-        assertEquals(MimeVersionFieldImpl.DEFAULT_MAJOR_VERSION, f.getMajorVersion());
-        assertEquals(MimeVersionFieldImpl.DEFAULT_MINOR_VERSION, f.getMinorVersion());
-        assertNotNull(f.getParseException());
+        Assert.assertEquals(MimeVersionFieldImpl.DEFAULT_MAJOR_VERSION, f.getMajorVersion());
+        Assert.assertEquals(MimeVersionFieldImpl.DEFAULT_MINOR_VERSION, f.getMinorVersion());
+        Assert.assertNotNull(f.getParseException());
     }
 
 }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/UnstructuredFieldTest.java Thu Dec 27 13:23:54 2012
@@ -20,23 +20,23 @@
 package org.apache.james.mime4j.field;
 
 import org.apache.james.mime4j.dom.field.UnstructuredField;
-import org.apache.james.mime4j.field.DefaultFieldParser;
+import org.junit.Assert;
+import org.junit.Test;
 
-import junit.framework.TestCase;
-
-public class UnstructuredFieldTest extends TestCase {
+public class UnstructuredFieldTest {
 
+    @Test
     public void testGetBody() throws Exception {
         UnstructuredField f = null;
 
         f = (UnstructuredField) DefaultFieldParser.parse("Subject: Yada\r\n yada yada\r\n");
-        assertEquals("Testing folding value 1", "Yada yada yada", f.getValue());
+        Assert.assertEquals("Testing folding value 1", "Yada yada yada", f.getValue());
 
         f = (UnstructuredField) DefaultFieldParser.parse("Subject:  \r\n\tyada");
-        assertEquals("Testing folding value 2", " \tyada", f.getValue());
+        Assert.assertEquals("Testing folding value 2", " \tyada", f.getValue());
 
         f = (UnstructuredField) DefaultFieldParser.parse("Subject:yada");
-        assertEquals("Testing value without a leading ' '", "yada", f.getValue());
+        Assert.assertEquals("Testing value without a leading ' '", "yada", f.getValue());
     }
 
 }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java Thu Dec 27 13:23:54 2012
@@ -24,131 +24,138 @@ import org.apache.james.mime4j.dom.addre
 import org.apache.james.mime4j.dom.address.DomainList;
 import org.apache.james.mime4j.dom.address.Mailbox;
 import org.apache.james.mime4j.dom.address.MailboxList;
-import org.apache.james.mime4j.field.address.ParseException;
+import org.junit.Assert;
+import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
-public class AddressTest extends TestCase {
+public class AddressTest {
 
+    @Test
     public void testExceptionTree() {
         // make sure that our ParseException extends MimeException.
-        assertTrue(MimeException.class.isAssignableFrom(ParseException.class));
+        Assert.assertTrue(MimeException.class.isAssignableFrom(ParseException.class));
     }
 
+    @Test
     public void testNullConstructorAndBadUsage() {
         AddressList al = new AddressList(null, false);
-        assertEquals(0, al.size());
+        Assert.assertEquals(0, al.size());
 
         try {
             al.get(-1);
-            fail("Expected index out of bound exception!");
+            Assert.fail("Expected index out of bound exception!");
         } catch (IndexOutOfBoundsException e) {
         }
 
         try {
             al.get(0);
-            fail("Expected index out of bound exception!");
+            Assert.fail("Expected index out of bound exception!");
         } catch (IndexOutOfBoundsException e) {
         }
     }
 
 
+    @Test
     public void testEmptyDomainList() {
         DomainList dl = new DomainList(null);
-        assertEquals(0, dl.size());
+        Assert.assertEquals(0, dl.size());
 
         try {
             dl.get(-1);
-            fail("Expected index out of bound exception!");
+            Assert.fail("Expected index out of bound exception!");
         } catch (IndexOutOfBoundsException e) {
         }
 
         try {
             dl.get(0);
-            fail("Expected index out of bound exception!");
+            Assert.fail("Expected index out of bound exception!");
         } catch (IndexOutOfBoundsException e) {
         }
     }
 
+    @Test
     public void testDomainList() {
         List<String> al = new ArrayList<String>();
         al.add("example.com");
 
         // changing the list passed does not change DomainList's state
         DomainList dl = new DomainList(al);
-        assertEquals(1, dl.size());
+        Assert.assertEquals(1, dl.size());
         al.add("foo.example.com");
-        assertEquals(1, dl.size());
+        Assert.assertEquals(1, dl.size());
 
         // cloned arraylist
         DomainList dlcopy = new DomainList(al);
-        assertEquals(2, dlcopy.size());
+        Assert.assertEquals(2, dlcopy.size());
         al.add("bar.example.com");
-        assertEquals(2, dlcopy.size());
+        Assert.assertEquals(2, dlcopy.size());
 
         // check route string
-        assertEquals("@example.com,@foo.example.com", dlcopy.toRouteString());
+        Assert.assertEquals("@example.com,@foo.example.com", dlcopy.toRouteString());
     }
 
 
+    @Test
     public void testEmptyMailboxList() {
         MailboxList ml = new MailboxList(null, false);
-        assertEquals(0, ml.size());
+        Assert.assertEquals(0, ml.size());
 
         try {
             ml.get(-1);
-            fail("Expected index out of bound exception!");
+            Assert.fail("Expected index out of bound exception!");
         } catch (IndexOutOfBoundsException e) {
         }
 
         try {
             ml.get(0);
-            fail("Expected index out of bound exception!");
+            Assert.fail("Expected index out of bound exception!");
         } catch (IndexOutOfBoundsException e) {
         }
     }
 
+    @Test
     public void testMailboxList() {
         List<Mailbox> al = new ArrayList<Mailbox>();
-        al.add(new Mailbox("local","example.com"));
+        al.add(new Mailbox("local", "example.com"));
 
         // shared arraylist
         MailboxList ml = new MailboxList(al, true);
-        assertEquals(1, ml.size());
+        Assert.assertEquals(1, ml.size());
         al.add(new Mailbox("local2", "foo.example.com"));
-        assertEquals(2, ml.size());
+        Assert.assertEquals(2, ml.size());
 
         // cloned arraylist
         MailboxList mlcopy = new MailboxList(al, false);
-        assertEquals(2, mlcopy.size());
+        Assert.assertEquals(2, mlcopy.size());
         al.add(new Mailbox("local3", "bar.example.com"));
-        assertEquals(2, mlcopy.size());
+        Assert.assertEquals(2, mlcopy.size());
     }
 
+    @Test
     public void testMailboxEquals() throws Exception {
         Mailbox m1 = new Mailbox("john.doe", "acme.org");
         Mailbox m2 = new Mailbox("john doe", "acme.org");
         Mailbox m3 = new Mailbox("john.doe", "Acme.Org");
         Mailbox m4 = new Mailbox("john.doe", null);
-        assertTrue(m1.equals(m1));
-        assertFalse(m1.equals(m2));
-        assertTrue(m1.equals(m3));
-        assertFalse(m1.equals(m4));
-        assertFalse(m1.equals(null));
+        Assert.assertTrue(m1.equals(m1));
+        Assert.assertFalse(m1.equals(m2));
+        Assert.assertTrue(m1.equals(m3));
+        Assert.assertFalse(m1.equals(m4));
+        Assert.assertFalse(m1.equals(null));
     }
 
+    @Test
     public void testMailboxHashCode() throws Exception {
         Mailbox m1 = new Mailbox("john.doe", "acme.org");
         Mailbox m2 = new Mailbox("john doe", "acme.org");
         Mailbox m3 = new Mailbox("john.doe", "Acme.Org");
         Mailbox m4 = new Mailbox("john.doe", null);
-        assertTrue(m1.hashCode() == m1.hashCode());
-        assertFalse(m1.hashCode() == m2.hashCode());
-        assertTrue(m1.hashCode() == m3.hashCode());
-        assertFalse(m1.hashCode() == m4.hashCode());
+        Assert.assertTrue(m1.hashCode() == m1.hashCode());
+        Assert.assertFalse(m1.hashCode() == m2.hashCode());
+        Assert.assertTrue(m1.hashCode() == m3.hashCode());
+        Assert.assertFalse(m1.hashCode() == m4.hashCode());
     }
 
 }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/DefaultAddressBuilderTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/DefaultAddressBuilderTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/DefaultAddressBuilderTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/DefaultAddressBuilderTest.java Thu Dec 27 13:23:54 2012
@@ -25,155 +25,166 @@ import org.apache.james.mime4j.dom.addre
 import org.apache.james.mime4j.dom.address.Group;
 import org.apache.james.mime4j.dom.address.Mailbox;
 import org.apache.james.mime4j.dom.address.MailboxList;
-import org.apache.james.mime4j.field.address.ParseException;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
-public class DefaultAddressBuilderTest extends TestCase {
+public class DefaultAddressBuilderTest {
 
     private AddressBuilder parser;
 
-    @Override
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         parser = AddressBuilder.DEFAULT;
     }
 
+    @Test
     public void testParseMailbox() throws ParseException {
         Mailbox mailbox1 = parser.parseMailbox("John Doe <jdoe@machine(comment).  example>");
-        assertEquals("John Doe", mailbox1.getName());
-        assertEquals("jdoe", mailbox1.getLocalPart());
-        assertEquals("machine.example", mailbox1.getDomain());
+        Assert.assertEquals("John Doe", mailbox1.getName());
+        Assert.assertEquals("jdoe", mailbox1.getLocalPart());
+        Assert.assertEquals("machine.example", mailbox1.getDomain());
 
         Mailbox mailbox2 = parser.parseMailbox("Mary Smith \t    \t\t  <mary@example.net>");
-        assertEquals("Mary Smith", mailbox2.getName());
-        assertEquals("mary", mailbox2.getLocalPart());
-        assertEquals("example.net", mailbox2.getDomain());
+        Assert.assertEquals("Mary Smith", mailbox2.getName());
+        Assert.assertEquals("mary", mailbox2.getLocalPart());
+        Assert.assertEquals("example.net", mailbox2.getDomain());
 
         Mailbox mailbox3 = parser.parseMailbox("john.doe@acme.org");
-        assertNull(mailbox3.getName());
-        assertEquals("john.doe@acme.org", mailbox3.getAddress());
+        Assert.assertNull(mailbox3.getName());
+        Assert.assertEquals("john.doe@acme.org", mailbox3.getAddress());
 
         Mailbox mailbox4 = parser.parseMailbox("Mary Smith <mary@example.net>");
-        assertEquals("Mary Smith", mailbox4.getName());
-        assertEquals("mary@example.net", mailbox4.getAddress());
+        Assert.assertEquals("Mary Smith", mailbox4.getName());
+        Assert.assertEquals("mary@example.net", mailbox4.getAddress());
 
         // non-ascii should be allowed in quoted strings
         Mailbox mailbox5 = parser.parseMailbox(
                 "\"Hans M\374ller\" <hans.mueller@acme.org>");
-        assertEquals("Hans M\374ller", mailbox5.getName());
-        assertEquals("hans.mueller@acme.org", mailbox5.getAddress());
+        Assert.assertEquals("Hans M\374ller", mailbox5.getName());
+        Assert.assertEquals("hans.mueller@acme.org", mailbox5.getAddress());
 
     }
 
+    @Test
     public void testParseMailboxEncoded() throws ParseException {
         Mailbox mailbox1 = parser.parseMailbox("=?ISO-8859-1?B?c3R1ZmY=?= <stuff@localhost.localdomain>");
-        assertEquals("stuff", mailbox1.getName());
-        assertEquals("stuff", mailbox1.getLocalPart());
-        assertEquals("localhost.localdomain", mailbox1.getDomain());
+        Assert.assertEquals("stuff", mailbox1.getName());
+        Assert.assertEquals("stuff", mailbox1.getLocalPart());
+        Assert.assertEquals("localhost.localdomain", mailbox1.getDomain());
     }
 
+    @Test
     public void testParseMailboxObsoleteSynatax() throws ParseException {
         Mailbox mailbox1 = parser.parseMailbox("< (route)(obsolete) " +
                 "@host1.domain1 , @host2 . domain2:  foo@bar.org>");
-        assertEquals(null, mailbox1.getName());
-        assertEquals("foo", mailbox1.getLocalPart());
-        assertEquals("bar.org", mailbox1.getDomain());
+        Assert.assertEquals(null, mailbox1.getName());
+        Assert.assertEquals("foo", mailbox1.getLocalPart());
+        Assert.assertEquals("bar.org", mailbox1.getDomain());
         DomainList domainList = mailbox1.getRoute();
-        assertNotNull(domainList);
-        assertEquals(2, domainList.size());
-        assertEquals("host1.domain1", domainList.get(0));
-        assertEquals("host2.domain2", domainList.get(1));
+        Assert.assertNotNull(domainList);
+        Assert.assertEquals(2, domainList.size());
+        Assert.assertEquals("host1.domain1", domainList.get(0));
+        Assert.assertEquals("host2.domain2", domainList.get(1));
     }
 
+    @Test
     public void testParseInvalidMailbox() throws Exception {
         try {
             parser.parseMailbox("g: Mary Smith <mary@example.net>;");
-            fail();
+            Assert.fail();
         } catch (ParseException expected) {
         }
         try {
             parser.parseMailbox("Mary Smith <mary@example.net>, hans.mueller@acme.org");
-            fail();
+            Assert.fail();
         } catch (ParseException expected) {
         }
     }
 
+    @Test
     public void testParseAddressList() throws ParseException {
         AddressList addrList1 = parser.parseAddressList("John Doe <jdoe@machine(comment).  example>");
-        assertEquals(1, addrList1.size());
-        Mailbox mailbox1 = (Mailbox)addrList1.get(0);
-        assertEquals("John Doe", mailbox1.getName());
-        assertEquals("jdoe", mailbox1.getLocalPart());
-        assertEquals("machine.example", mailbox1.getDomain());
+        Assert.assertEquals(1, addrList1.size());
+        Mailbox mailbox1 = (Mailbox) addrList1.get(0);
+        Assert.assertEquals("John Doe", mailbox1.getName());
+        Assert.assertEquals("jdoe", mailbox1.getLocalPart());
+        Assert.assertEquals("machine.example", mailbox1.getDomain());
 
         AddressList addrList2 = parser.parseAddressList("Mary Smith \t    \t\t  <mary@example.net>");
-        assertEquals(1, addrList2.size());
-        Mailbox mailbox2 = (Mailbox)addrList2.get(0);
-        assertEquals("Mary Smith", mailbox2.getName());
-        assertEquals("mary", mailbox2.getLocalPart());
-        assertEquals("example.net", mailbox2.getDomain());
+        Assert.assertEquals(1, addrList2.size());
+        Mailbox mailbox2 = (Mailbox) addrList2.get(0);
+        Assert.assertEquals("Mary Smith", mailbox2.getName());
+        Assert.assertEquals("mary", mailbox2.getLocalPart());
+        Assert.assertEquals("example.net", mailbox2.getDomain());
     }
 
+    @Test
     public void testEmptyGroup() throws ParseException {
         AddressList addrList = parser.parseAddressList("undisclosed-recipients:;");
-        assertEquals(1, addrList.size());
-        Group group = (Group)addrList.get(0);
-        assertEquals(0, group.getMailboxes().size());
-        assertEquals("undisclosed-recipients", group.getName());
+        Assert.assertEquals(1, addrList.size());
+        Group group = (Group) addrList.get(0);
+        Assert.assertEquals(0, group.getMailboxes().size());
+        Assert.assertEquals("undisclosed-recipients", group.getName());
     }
 
+    @Test
     public void testMessyGroupAndMailbox() throws ParseException {
         AddressList addrList = parser.parseAddressList(
                 "Marketing  folks :  Jane Smith < jane @ example . net >," +
-                " \" Jack \\\"Jackie\\\" Jones \" < jjones@example.com > (comment(comment)); ,, (comment)  ," +
-                " <@example . net,@example(ignore\\)).com:(ignore)john@(ignore)example.net>");
-        assertEquals(2, addrList.size());
-
-        Group group = (Group)addrList.get(0);
-        assertEquals("Marketing  folks", group.getName());
-        assertEquals(2, group.getMailboxes().size());
+                        " \" Jack \\\"Jackie\\\" Jones \" < jjones@example.com > (comment(comment)); ,, (comment)  ," +
+                        " <@example . net,@example(ignore\\)).com:(ignore)john@(ignore)example.net>");
+        Assert.assertEquals(2, addrList.size());
+
+        Group group = (Group) addrList.get(0);
+        Assert.assertEquals("Marketing  folks", group.getName());
+        Assert.assertEquals(2, group.getMailboxes().size());
 
         Mailbox mailbox1 = group.getMailboxes().get(0);
         Mailbox mailbox2 = group.getMailboxes().get(1);
 
-        assertEquals("Jane Smith", mailbox1.getName());
-        assertEquals("jane", mailbox1.getLocalPart());
-        assertEquals("example.net", mailbox1.getDomain());
-
-        assertEquals(" Jack \"Jackie\" Jones ", mailbox2.getName());
-        assertEquals("jjones", mailbox2.getLocalPart());
-        assertEquals("example.com", mailbox2.getDomain());
-
-        Mailbox mailbox = (Mailbox)addrList.get(1);
-        assertEquals("john", mailbox.getLocalPart());
-        assertEquals("example.net", mailbox.getDomain());
-        assertEquals(2, mailbox.getRoute().size());
-        assertEquals("example.net", mailbox.getRoute().get(0));
-        assertEquals("example.com", mailbox.getRoute().get(1));
+        Assert.assertEquals("Jane Smith", mailbox1.getName());
+        Assert.assertEquals("jane", mailbox1.getLocalPart());
+        Assert.assertEquals("example.net", mailbox1.getDomain());
+
+        Assert.assertEquals(" Jack \"Jackie\" Jones ", mailbox2.getName());
+        Assert.assertEquals("jjones", mailbox2.getLocalPart());
+        Assert.assertEquals("example.com", mailbox2.getDomain());
+
+        Mailbox mailbox = (Mailbox) addrList.get(1);
+        Assert.assertEquals("john", mailbox.getLocalPart());
+        Assert.assertEquals("example.net", mailbox.getDomain());
+        Assert.assertEquals(2, mailbox.getRoute().size());
+        Assert.assertEquals("example.net", mailbox.getRoute().get(0));
+        Assert.assertEquals("example.com", mailbox.getRoute().get(1));
     }
 
+    @Test
     public void testEmptyAddressList() throws ParseException {
-        assertEquals(0, parser.parseAddressList("  \t   \t ").size());
-        assertEquals(0, parser.parseAddressList("  \t  ,  , , ,,, , \t ").size());
+        Assert.assertEquals(0, parser.parseAddressList("  \t   \t ").size());
+        Assert.assertEquals(0, parser.parseAddressList("  \t  ,  , , ,,, , \t ").size());
     }
 
+    @Test
     public void testSimpleForm() throws ParseException {
         AddressList addrList = parser.parseAddressList("\"a b c d e f g\" (comment) @example.net");
-        assertEquals(1, addrList.size());
-        Mailbox mailbox = (Mailbox)addrList.get(0);
-        assertEquals("a b c d e f g", mailbox.getLocalPart());
-        assertEquals("example.net", mailbox.getDomain());
+        Assert.assertEquals(1, addrList.size());
+        Mailbox mailbox = (Mailbox) addrList.get(0);
+        Assert.assertEquals("a b c d e f g", mailbox.getLocalPart());
+        Assert.assertEquals("example.net", mailbox.getDomain());
     }
 
+    @Test
     public void testFlatten() throws ParseException {
         AddressList addrList = parser.parseAddressList("dev : one@example.com, two@example.com; , ,,, marketing:three@example.com ,four@example.com;, five@example.com");
-        assertEquals(3, addrList.size());
-        assertEquals(5, addrList.flatten().size());
+        Assert.assertEquals(3, addrList.size());
+        Assert.assertEquals(5, addrList.flatten().size());
     }
 
+    @Test
     public void testTortureTest() throws ParseException {
 
         // Source: http://mailformat.dan.info/headers/from.html
@@ -219,16 +230,17 @@ public class DefaultAddressBuilderTest e
 
     }
 
+    @Test
     public void testLexicalError() {
         // ensure that TokenMgrError doesn't get thrown
         try {
             parser.parseAddressList(")");
-            fail("Expected parsing error");
-        }
-        catch (ParseException e) {
+            Assert.fail("Expected parsing error");
+        } catch (ParseException e) {
         }
     }
 
+    @Test
     public void testAddressList() throws ParseException {
         AddressList addlist = parser.parseAddressList("foo@example.com, bar@example.com, third@example.com");
         List<Address> al = new ArrayList<Address>();
@@ -236,70 +248,74 @@ public class DefaultAddressBuilderTest e
 
         // shared arraylist
         AddressList dl = new AddressList(al, true);
-        assertEquals(1, dl.size());
+        Assert.assertEquals(1, dl.size());
         al.add(addlist.get(1));
-        assertEquals(2, dl.size());
+        Assert.assertEquals(2, dl.size());
 
         // cloned arraylist
         AddressList dlcopy = new AddressList(al, false);
-        assertEquals(2, dlcopy.size());
+        Assert.assertEquals(2, dlcopy.size());
         al.add(addlist.get(2));
-        assertEquals(2, dlcopy.size());
+        Assert.assertEquals(2, dlcopy.size());
 
         // check route string
-        assertEquals(2, dlcopy.flatten().size());
+        Assert.assertEquals(2, dlcopy.flatten().size());
     }
 
+    @Test
     public void testParseAddress() throws Exception {
         Address address = parser.parseAddress("Mary Smith <mary@example.net>");
-        assertTrue(address instanceof Mailbox);
-        assertEquals("Mary Smith", ((Mailbox) address).getName());
-        assertEquals("mary@example.net", ((Mailbox) address).getAddress());
+        Assert.assertTrue(address instanceof Mailbox);
+        Assert.assertEquals("Mary Smith", ((Mailbox) address).getName());
+        Assert.assertEquals("mary@example.net", ((Mailbox) address).getAddress());
 
         address = parser.parseAddress("group: Mary Smith <mary@example.net>;");
-        assertTrue(address instanceof Group);
-        assertEquals("group", ((Group) address).getName());
-        assertEquals("Mary Smith", ((Group) address).getMailboxes().get(0)
+        Assert.assertTrue(address instanceof Group);
+        Assert.assertEquals("group", ((Group) address).getName());
+        Assert.assertEquals("Mary Smith", ((Group) address).getMailboxes().get(0)
                 .getName());
-        assertEquals("mary@example.net", ((Group) address).getMailboxes()
+        Assert.assertEquals("mary@example.net", ((Group) address).getMailboxes()
                 .get(0).getAddress());
     }
 
+    @Test
     public void testParseInvalidAddress() throws Exception {
         try {
             parser.parseGroup("john.doe@acme.org, jane.doe@acme.org");
-            fail();
+            Assert.fail();
         } catch (ParseException expected) {
         }
     }
 
+    @Test
     public void testParseGroup() throws Exception {
         Group group = parser.parseGroup(
                 "group: john.doe@acme.org, Mary Smith <mary@example.net>;");
-        assertEquals("group", group.getName());
+        Assert.assertEquals("group", group.getName());
 
         MailboxList mailboxes = group.getMailboxes();
-        assertEquals(2, mailboxes.size());
+        Assert.assertEquals(2, mailboxes.size());
 
         Mailbox mailbox1 = mailboxes.get(0);
-        assertNull(mailbox1.getName());
-        assertEquals("john.doe@acme.org", mailbox1.getAddress());
+        Assert.assertNull(mailbox1.getName());
+        Assert.assertEquals("john.doe@acme.org", mailbox1.getAddress());
 
         Mailbox mailbox2 = mailboxes.get(1);
-        assertEquals("Mary Smith", mailbox2.getName());
-        assertEquals("mary@example.net", mailbox2.getAddress());
+        Assert.assertEquals("Mary Smith", mailbox2.getName());
+        Assert.assertEquals("mary@example.net", mailbox2.getAddress());
     }
 
+    @Test
     public void testParseInvalidGroup() throws Exception {
         try {
             parser.parseGroup("john.doe@acme.org");
-            fail();
+            Assert.fail();
         } catch (ParseException expected) {
         }
 
         try {
             parser.parseGroup("g1: john.doe@acme.org;, g2: mary@example.net;");
-            fail();
+            Assert.fail();
         } catch (ParseException expected) {
         }
     }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/DefaultAddressFormatterTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/DefaultAddressFormatterTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/DefaultAddressFormatterTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/DefaultAddressFormatterTest.java Thu Dec 27 13:23:54 2012
@@ -19,68 +19,73 @@
 
 package org.apache.james.mime4j.field.address;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.TestCase;
-
 import org.apache.james.mime4j.dom.address.DomainList;
 import org.apache.james.mime4j.dom.address.Group;
 import org.apache.james.mime4j.dom.address.Mailbox;
 import org.apache.james.mime4j.dom.address.MailboxList;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
-public class DefaultAddressFormatterTest extends TestCase {
+public class DefaultAddressFormatterTest {
 
     private AddressFormatter formatter;
 
-    @Override
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         formatter = AddressFormatter.DEFAULT;
     }
 
+    @Test
     public void testGroupSerialization() {
         List<Mailbox> al = new ArrayList<Mailbox>();
         al.add(new Mailbox("test", "example.com"));
         al.add(new Mailbox("Foo!", "foo", "example.com"));
         DomainList dl = new DomainList(new ArrayList<String>(
-                Arrays.asList(new String[] {"foo.example.com"})));
+                Arrays.asList(new String[]{"foo.example.com"})));
         Mailbox mailbox = new Mailbox("Foo Bar", dl, "foo2", "example.com");
-        assertSame(dl, mailbox.getRoute());
+        Assert.assertSame(dl, mailbox.getRoute());
         al.add(mailbox);
         Group g = new Group("group", new MailboxList(al, false));
         String s = formatter.format(g, false);
-        assertEquals("group: test@example.com, Foo! <foo@example.com>, Foo Bar <foo2@example.com>;", s);
+        Assert.assertEquals("group: test@example.com, Foo! <foo@example.com>, Foo Bar <foo2@example.com>;", s);
     }
 
+    @Test
     public void testMailboxGetEncodedString() throws Exception {
         Mailbox m1 = new Mailbox("john.doe", "acme.org");
-        assertEquals("john.doe@acme.org", formatter.encode(m1));
+        Assert.assertEquals("john.doe@acme.org", formatter.encode(m1));
         Mailbox m2 = new Mailbox("john doe", "acme.org");
-        assertEquals("\"john doe\"@acme.org", formatter.encode(m2));
+        Assert.assertEquals("\"john doe\"@acme.org", formatter.encode(m2));
         Mailbox m3 = new Mailbox("John Doe", "john.doe", "acme.org");
-        assertEquals("John Doe <john.doe@acme.org>", formatter.encode(m3));
+        Assert.assertEquals("John Doe <john.doe@acme.org>", formatter.encode(m3));
         Mailbox m4 = new Mailbox("John Doe @Home", "john.doe", "acme.org");
-        assertEquals("\"John Doe @Home\" <john.doe@acme.org>", formatter.encode(m4));
+        Assert.assertEquals("\"John Doe @Home\" <john.doe@acme.org>", formatter.encode(m4));
         Mailbox m5 = new Mailbox("Hans M\374ller", "hans.mueller", "acme.org");
-        assertEquals("=?ISO-8859-1?Q?Hans_M=FCller?= <hans.mueller@acme.org>", formatter.encode(m5));
+        Assert.assertEquals("=?ISO-8859-1?Q?Hans_M=FCller?= <hans.mueller@acme.org>", formatter.encode(m5));
     }
 
+    @Test
     public void testGroupGetEncodedString() throws Exception {
         List<Mailbox> al = new ArrayList<Mailbox>();
         al.add(new Mailbox("test", "example.com"));
         al.add(new Mailbox("Foo!", "foo", "example.com"));
         al.add(new Mailbox("Hans M\374ller", "hans.mueller", "acme.org"));
         Group g = new Group("group @work", new MailboxList(al, false));
-        assertEquals("\"group @work\": test@example.com, "
+        Assert.assertEquals("\"group @work\": test@example.com, "
                 + "Foo! <foo@example.com>, =?ISO-8859-1?Q?Hans_M=FCller?="
                 + " <hans.mueller@acme.org>;", formatter.encode(g));
     }
 
+    @Test
     public void testEmptyGroupGetEncodedString() throws Exception {
         MailboxList emptyMailboxes = new MailboxList(null, true);
         Group g = new Group("Undisclosed recipients", emptyMailboxes);
-        assertEquals("Undisclosed recipients:;", formatter.encode(g));
+        Assert.assertEquals("Undisclosed recipients:;", formatter.encode(g));
     }
 
 }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/LenientAddressBuilderTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/LenientAddressBuilderTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/LenientAddressBuilderTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/LenientAddressBuilderTest.java Thu Dec 27 13:23:54 2012
@@ -19,10 +19,6 @@
 
 package org.apache.james.mime4j.field.address;
 
-import java.util.List;
-
-import junit.framework.TestCase;
-
 import org.apache.james.mime4j.dom.address.Address;
 import org.apache.james.mime4j.dom.address.AddressList;
 import org.apache.james.mime4j.dom.address.DomainList;
@@ -33,337 +29,371 @@ import org.apache.james.mime4j.stream.Pa
 import org.apache.james.mime4j.stream.RawFieldParser;
 import org.apache.james.mime4j.util.ByteSequence;
 import org.apache.james.mime4j.util.ContentUtil;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.List;
 
-public class LenientAddressBuilderTest extends TestCase {
+public class LenientAddressBuilderTest {
 
     private LenientAddressBuilder parser;
 
-    @Override
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         parser = LenientAddressBuilder.DEFAULT;
     }
 
+    @Test
     public void testParseDomain() throws Exception {
         String s = "machine (comment).  example (dot). com  ; more stuff";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
 
         String domain = parser.parseDomain(raw, cursor, RawFieldParser.INIT_BITSET(';'));
-        assertEquals("machine.example.com", domain);
+        Assert.assertEquals("machine.example.com", domain);
     }
 
+    @Test
     public void testParseMailboxAddress() throws Exception {
         String s = "<  some  one @ some host . some where . com >";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
 
         Mailbox mailbox = parser.parseMailboxAddress(null, raw, cursor);
-        assertEquals("some one@somehost.somewhere.com", mailbox.getAddress());
+        Assert.assertEquals("some one@somehost.somewhere.com", mailbox.getAddress());
     }
 
+    @Test
     public void testParseMailboxNullAddress() throws Exception {
         String s = "<>";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
 
         Mailbox mailbox = parser.parseMailboxAddress(null, raw, cursor);
-        assertEquals("", mailbox.getAddress());
+        Assert.assertEquals("", mailbox.getAddress());
     }
-    
+
+    @Test
     public void testParseMailboxEmptyAddress() throws Exception {
         String s = "<    >";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
 
         Mailbox mailbox = parser.parseMailboxAddress(null, raw, cursor);
-        assertEquals("", mailbox.getAddress());
+        Assert.assertEquals("", mailbox.getAddress());
     }
-    
+
+    @Test
     public void testParseAddressQuotedLocalPart() throws Exception {
         String s = "<  \"some  one\"   @ some host . some where . com >";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
 
         Mailbox mailbox = parser.parseMailboxAddress(null, raw, cursor);
-        assertEquals("some  one@somehost.somewhere.com", mailbox.getAddress());
+        Assert.assertEquals("some  one@somehost.somewhere.com", mailbox.getAddress());
     }
 
+    @Test
     public void testParseAddressTruncated() throws Exception {
         String s = "<  some  one  ";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
 
         Mailbox mailbox = parser.parseMailboxAddress(null, raw, cursor);
-        assertEquals("some one", mailbox.getAddress());
+        Assert.assertEquals("some one", mailbox.getAddress());
     }
 
+    @Test
     public void testParseAddressTrailingComments() throws Exception {
         String s = "< someone@somehost.somewhere.com  > (garbage) ; ";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
 
         Mailbox mailbox = parser.parseMailboxAddress(null, raw, cursor);
-        assertEquals("someone@somehost.somewhere.com", mailbox.getAddress());
-        assertEquals(';', raw.byteAt(cursor.getPos()));
+        Assert.assertEquals("someone@somehost.somewhere.com", mailbox.getAddress());
+        Assert.assertEquals(';', raw.byteAt(cursor.getPos()));
     }
 
+    @Test
     public void testParseAddressTrailingGarbage() throws Exception {
         String s = "< someone@somehost.somewhere.com  > garbage) ; ";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
 
         Mailbox mailbox = parser.parseMailboxAddress(null, raw, cursor);
-        assertEquals("someone@somehost.somewhere.com", mailbox.getAddress());
-        assertEquals('g', raw.byteAt(cursor.getPos()));
+        Assert.assertEquals("someone@somehost.somewhere.com", mailbox.getAddress());
+        Assert.assertEquals('g', raw.byteAt(cursor.getPos()));
     }
 
+    @Test
     public void testParseRoute() throws Exception {
         String s = "  @a, @b, @c :me@home";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
 
         DomainList route = parser.parseRoute(raw, cursor, null);
-        assertNotNull(route);
-        assertEquals(3, route.size());
-        assertEquals("a", route.get(0));
-        assertEquals("b", route.get(1));
-        assertEquals("c", route.get(2));
-        assertEquals('m', raw.byteAt(cursor.getPos()));
+        Assert.assertNotNull(route);
+        Assert.assertEquals(3, route.size());
+        Assert.assertEquals("a", route.get(0));
+        Assert.assertEquals("b", route.get(1));
+        Assert.assertEquals("c", route.get(2));
+        Assert.assertEquals('m', raw.byteAt(cursor.getPos()));
     }
 
+    @Test
     public void testParseAddressStartingWithAt() throws Exception {
         String s = "<@somehost.com@somehost.com>";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
 
         Mailbox mailbox = parser.parseMailboxAddress(null, raw, cursor);
-        assertEquals("", mailbox.getLocalPart());
-        assertEquals(null, mailbox.getDomain());
+        Assert.assertEquals("", mailbox.getLocalPart());
+        Assert.assertEquals(null, mailbox.getDomain());
         DomainList route = mailbox.getRoute();
-        assertNotNull(route);
-        assertEquals(1, route.size());
-        assertEquals("somehost.com@somehost.com", route.get(0));
+        Assert.assertNotNull(route);
+        Assert.assertEquals(1, route.size());
+        Assert.assertEquals("somehost.com@somehost.com", route.get(0));
     }
-    
+
+    @Test
     public void testParseNoRoute() throws Exception {
         String s = "stuff";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
 
         DomainList route = parser.parseRoute(raw, cursor, null);
-        assertNull(route);
+        Assert.assertNull(route);
     }
 
+    @Test
     public void testParseMailbox() throws Exception {
         Mailbox mailbox1 = parser.parseMailbox("John Doe <jdoe@machine(comment).  example>");
-        assertEquals("John Doe", mailbox1.getName());
-        assertEquals("jdoe", mailbox1.getLocalPart());
-        assertEquals("machine.example", mailbox1.getDomain());
+        Assert.assertEquals("John Doe", mailbox1.getName());
+        Assert.assertEquals("jdoe", mailbox1.getLocalPart());
+        Assert.assertEquals("machine.example", mailbox1.getDomain());
 
         Mailbox mailbox2 = parser.parseMailbox("Mary Smith \t    \t\t  <mary@example.net>");
-        assertEquals("Mary Smith", mailbox2.getName());
-        assertEquals("mary", mailbox2.getLocalPart());
-        assertEquals("example.net", mailbox2.getDomain());
+        Assert.assertEquals("Mary Smith", mailbox2.getName());
+        Assert.assertEquals("mary", mailbox2.getLocalPart());
+        Assert.assertEquals("example.net", mailbox2.getDomain());
 
         Mailbox mailbox3 = parser.parseMailbox("john.doe@acme.org");
-        assertNull(mailbox3.getName());
-        assertEquals("john.doe@acme.org", mailbox3.getAddress());
+        Assert.assertNull(mailbox3.getName());
+        Assert.assertEquals("john.doe@acme.org", mailbox3.getAddress());
 
         Mailbox mailbox4 = parser.parseMailbox("Mary Smith <mary@example.net>");
-        assertEquals("Mary Smith", mailbox4.getName());
-        assertEquals("mary@example.net", mailbox4.getAddress());
+        Assert.assertEquals("Mary Smith", mailbox4.getName());
+        Assert.assertEquals("mary@example.net", mailbox4.getAddress());
 
         // non-ascii should be allowed in quoted strings
         Mailbox mailbox5 = parser.parseMailbox(
                 "\"Hans M\374ller\" <hans.mueller@acme.org>");
-        assertEquals("Hans M\374ller", mailbox5.getName());
-        assertEquals("hans.mueller@acme.org", mailbox5.getAddress());
+        Assert.assertEquals("Hans M\374ller", mailbox5.getName());
+        Assert.assertEquals("hans.mueller@acme.org", mailbox5.getAddress());
     }
 
+    @Test
     public void testParseMailboxEncoded() throws ParseException {
         Mailbox mailbox1 = parser.parseMailbox("=?ISO-8859-1?B?c3R1ZmY=?= <stuff@localhost.localdomain>");
-        assertEquals("stuff", mailbox1.getName());
-        assertEquals("stuff", mailbox1.getLocalPart());
-        assertEquals("localhost.localdomain", mailbox1.getDomain());
+        Assert.assertEquals("stuff", mailbox1.getName());
+        Assert.assertEquals("stuff", mailbox1.getLocalPart());
+        Assert.assertEquals("localhost.localdomain", mailbox1.getDomain());
     }
 
+    @Test
     public void testParseMailboxNonASCII() throws Exception {
         Mailbox mailbox1 = parser.parseMailbox(
                 "Hans M\374ller <hans.mueller@acme.org>");
-        assertEquals("Hans M\374ller", mailbox1.getName());
-        assertEquals("hans.mueller@acme.org", mailbox1.getAddress());
+        Assert.assertEquals("Hans M\374ller", mailbox1.getName());
+        Assert.assertEquals("hans.mueller@acme.org", mailbox1.getAddress());
     }
 
+    @Test
     public void testParsePartialQuotes() throws Exception {
         Mailbox mailbox1 = parser.parseMailbox(
                 "Hans \"M\374ller\" is a good fella <hans.mueller@acme.org>");
-        assertEquals("Hans M\374ller is a good fella", mailbox1.getName());
-        assertEquals("hans.mueller@acme.org", mailbox1.getAddress());
+        Assert.assertEquals("Hans M\374ller is a good fella", mailbox1.getName());
+        Assert.assertEquals("hans.mueller@acme.org", mailbox1.getAddress());
     }
 
+    @Test
     public void testParseMailboxObsoleteSynatax() throws Exception {
         Mailbox mailbox1 = parser.parseMailbox("< (route)(obsolete) " +
                 "@host1.domain1 , @host2 . domain2:  foo@bar.org>");
-        assertEquals(null, mailbox1.getName());
-        assertEquals("foo", mailbox1.getLocalPart());
-        assertEquals("bar.org", mailbox1.getDomain());
+        Assert.assertEquals(null, mailbox1.getName());
+        Assert.assertEquals("foo", mailbox1.getLocalPart());
+        Assert.assertEquals("bar.org", mailbox1.getDomain());
         DomainList domainList = mailbox1.getRoute();
-        assertNotNull(domainList);
-        assertEquals(2, domainList.size());
-        assertEquals("host1.domain1", domainList.get(0));
-        assertEquals("host2.domain2", domainList.get(1));
+        Assert.assertNotNull(domainList);
+        Assert.assertEquals(2, domainList.size());
+        Assert.assertEquals("host1.domain1", domainList.get(0));
+        Assert.assertEquals("host2.domain2", domainList.get(1));
     }
 
+    @Test
     public void testParseMailboxEmpty() throws Exception {
         Mailbox mailbox1 = parser.parseMailbox("  ");
-        assertNull(mailbox1);
+        Assert.assertNull(mailbox1);
     }
 
+    @Test
     public void testParseMailboxList() throws Exception {
         String s = "a , b, ,,, c, d,;garbage";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
         List<Mailbox> mailboxes = parser.parseMailboxes(raw, cursor, RawFieldParser.INIT_BITSET(';'));
-        assertEquals(4, mailboxes.size());
+        Assert.assertEquals(4, mailboxes.size());
 
         Mailbox mailbox1 = mailboxes.get(0);
-        assertEquals("a", mailbox1.getAddress());
+        Assert.assertEquals("a", mailbox1.getAddress());
         Mailbox mailbox2 = mailboxes.get(1);
-        assertEquals("b", mailbox2.getAddress());
+        Assert.assertEquals("b", mailbox2.getAddress());
         Mailbox mailbox3 = mailboxes.get(2);
-        assertEquals("c", mailbox3.getAddress());
+        Assert.assertEquals("c", mailbox3.getAddress());
         Mailbox mailbox4 = mailboxes.get(3);
-        assertEquals("d", mailbox4.getAddress());
-        assertEquals(';', raw.byteAt(cursor.getPos()));
+        Assert.assertEquals("d", mailbox4.getAddress());
+        Assert.assertEquals(';', raw.byteAt(cursor.getPos()));
     }
 
+    @Test
     public void testParseMailboxListEmpty() throws Exception {
         String s = "   ";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
         List<Mailbox> mailboxes = parser.parseMailboxes(raw, cursor, RawFieldParser.INIT_BITSET(';'));
-        assertEquals(0, mailboxes.size());
+        Assert.assertEquals(0, mailboxes.size());
     }
 
+    @Test
     public void testParseGroup() throws Exception {
         String s = "group: john.doe@acme.org, Mary Smith <mary@example.net>";
         ByteSequence raw = ContentUtil.encode(s);
         ParserCursor cursor = new ParserCursor(0, s.length());
         Group group = parser.parseGroup(raw, cursor);
-        assertEquals("group", group.getName());
+        Assert.assertEquals("group", group.getName());
 
         MailboxList mailboxes = group.getMailboxes();
-        assertEquals(2, mailboxes.size());
+        Assert.assertEquals(2, mailboxes.size());
 
         Mailbox mailbox1 = mailboxes.get(0);
-        assertNull(mailbox1.getName());
-        assertEquals("john.doe@acme.org", mailbox1.getAddress());
+        Assert.assertNull(mailbox1.getName());
+        Assert.assertEquals("john.doe@acme.org", mailbox1.getAddress());
 
         Mailbox mailbox2 = mailboxes.get(1);
-        assertEquals("Mary Smith", mailbox2.getName());
-        assertEquals("mary@example.net", mailbox2.getAddress());
+        Assert.assertEquals("Mary Smith", mailbox2.getName());
+        Assert.assertEquals("mary@example.net", mailbox2.getAddress());
     }
 
+    @Test
     public void testParseInvalidGroup() throws Exception {
         Group group = parser.parseGroup("john.doe@acme.org");
-        assertEquals("john.doe@acme.org", group.getName());
+        Assert.assertEquals("john.doe@acme.org", group.getName());
 
         MailboxList mailboxes = group.getMailboxes();
-        assertEquals(0, mailboxes.size());
+        Assert.assertEquals(0, mailboxes.size());
     }
 
+    @Test
     public void testParseAddress() throws Exception {
         Address address = parser.parseAddress("Mary Smith <mary@example.net>");
-        assertTrue(address instanceof Mailbox);
+        Assert.assertTrue(address instanceof Mailbox);
         Mailbox mbox = (Mailbox) address;
-        assertEquals("Mary Smith", mbox.getName());
-        assertEquals("mary@example.net", mbox.getAddress());
+        Assert.assertEquals("Mary Smith", mbox.getName());
+        Assert.assertEquals("mary@example.net", mbox.getAddress());
 
         address = parser.parseAddress("group: Mary Smith <mary@example.net>;");
-        assertTrue(address instanceof Group);
+        Assert.assertTrue(address instanceof Group);
         Group group = (Group) address;
-        assertEquals("group", group.getName());
+        Assert.assertEquals("group", group.getName());
         MailboxList mailboxes = group.getMailboxes();
-        assertEquals(1, mailboxes.size());
+        Assert.assertEquals(1, mailboxes.size());
         mbox = mailboxes.get(0);
-        assertEquals("Mary Smith", mbox.getName());
-        assertEquals("mary@example.net", mbox.getAddress());
+        Assert.assertEquals("Mary Smith", mbox.getName());
+        Assert.assertEquals("mary@example.net", mbox.getAddress());
     }
 
+    @Test
     public void testParseAddressList() throws Exception {
         AddressList addrList1 = parser.parseAddressList("John Doe <jdoe@machine(comment).  example>");
-        assertEquals(1, addrList1.size());
-        Mailbox mailbox1 = (Mailbox)addrList1.get(0);
-        assertEquals("John Doe", mailbox1.getName());
-        assertEquals("jdoe", mailbox1.getLocalPart());
-        assertEquals("machine.example", mailbox1.getDomain());
+        Assert.assertEquals(1, addrList1.size());
+        Mailbox mailbox1 = (Mailbox) addrList1.get(0);
+        Assert.assertEquals("John Doe", mailbox1.getName());
+        Assert.assertEquals("jdoe", mailbox1.getLocalPart());
+        Assert.assertEquals("machine.example", mailbox1.getDomain());
 
         AddressList addrList2 = parser.parseAddressList("Mary Smith \t    \t\t  <mary@example.net>");
-        assertEquals(1, addrList2.size());
-        Mailbox mailbox2 = (Mailbox)addrList2.get(0);
-        assertEquals("Mary Smith", mailbox2.getName());
-        assertEquals("mary", mailbox2.getLocalPart());
-        assertEquals("example.net", mailbox2.getDomain());
+        Assert.assertEquals(1, addrList2.size());
+        Mailbox mailbox2 = (Mailbox) addrList2.get(0);
+        Assert.assertEquals("Mary Smith", mailbox2.getName());
+        Assert.assertEquals("mary", mailbox2.getLocalPart());
+        Assert.assertEquals("example.net", mailbox2.getDomain());
     }
 
+    @Test
     public void testEmptyGroup() throws Exception {
         AddressList addrList = parser.parseAddressList("undisclosed-recipients:;");
-        assertEquals(1, addrList.size());
-        Group group = (Group)addrList.get(0);
-        assertEquals(0, group.getMailboxes().size());
-        assertEquals("undisclosed-recipients", group.getName());
+        Assert.assertEquals(1, addrList.size());
+        Group group = (Group) addrList.get(0);
+        Assert.assertEquals(0, group.getMailboxes().size());
+        Assert.assertEquals("undisclosed-recipients", group.getName());
     }
 
+    @Test
     public void testMessyGroupAndMailbox() throws Exception {
         AddressList addrList = parser.parseAddressList(
                 "Marketing  folks :  Jane Smith < jane @ example . net >," +
-                " \" Jack \\\"Jackie\\\" Jones \" < jjones@example.com > (comment(comment)); ,, (comment)  ," +
-                " <@example . net,@example(ignore\\)).com:(ignore)john@(ignore)example.net>");
-        assertEquals(2, addrList.size());
-
-        Group group = (Group)addrList.get(0);
-        assertEquals("Marketing folks", group.getName());
-        assertEquals(2, group.getMailboxes().size());
+                        " \" Jack \\\"Jackie\\\" Jones \" < jjones@example.com > (comment(comment)); ,, (comment)  ," +
+                        " <@example . net,@example(ignore\\)).com:(ignore)john@(ignore)example.net>");
+        Assert.assertEquals(2, addrList.size());
+
+        Group group = (Group) addrList.get(0);
+        Assert.assertEquals("Marketing folks", group.getName());
+        Assert.assertEquals(2, group.getMailboxes().size());
 
         Mailbox mailbox1 = group.getMailboxes().get(0);
         Mailbox mailbox2 = group.getMailboxes().get(1);
 
-        assertEquals("Jane Smith", mailbox1.getName());
-        assertEquals("jane", mailbox1.getLocalPart());
-        assertEquals("example.net", mailbox1.getDomain());
-
-        assertEquals(" Jack \"Jackie\" Jones ", mailbox2.getName());
-        assertEquals("jjones", mailbox2.getLocalPart());
-        assertEquals("example.com", mailbox2.getDomain());
-
-        Mailbox mailbox = (Mailbox)addrList.get(1);
-        assertEquals("john", mailbox.getLocalPart());
-        assertEquals("example.net", mailbox.getDomain());
-        assertEquals(2, mailbox.getRoute().size());
-        assertEquals("example.net", mailbox.getRoute().get(0));
-        assertEquals("example.com", mailbox.getRoute().get(1));
+        Assert.assertEquals("Jane Smith", mailbox1.getName());
+        Assert.assertEquals("jane", mailbox1.getLocalPart());
+        Assert.assertEquals("example.net", mailbox1.getDomain());
+
+        Assert.assertEquals(" Jack \"Jackie\" Jones ", mailbox2.getName());
+        Assert.assertEquals("jjones", mailbox2.getLocalPart());
+        Assert.assertEquals("example.com", mailbox2.getDomain());
+
+        Mailbox mailbox = (Mailbox) addrList.get(1);
+        Assert.assertEquals("john", mailbox.getLocalPart());
+        Assert.assertEquals("example.net", mailbox.getDomain());
+        Assert.assertEquals(2, mailbox.getRoute().size());
+        Assert.assertEquals("example.net", mailbox.getRoute().get(0));
+        Assert.assertEquals("example.com", mailbox.getRoute().get(1));
     }
 
+    @Test
     public void testEmptyAddressList() throws Exception {
-        assertEquals(0, parser.parseAddressList("").size());
-        assertEquals(0, parser.parseAddressList("  \t   \t ").size());
-        assertEquals(0, parser.parseAddressList("  \t  ,  , , ,,, , \t ").size());
+        Assert.assertEquals(0, parser.parseAddressList("").size());
+        Assert.assertEquals(0, parser.parseAddressList("  \t   \t ").size());
+        Assert.assertEquals(0, parser.parseAddressList("  \t  ,  , , ,,, , \t ").size());
     }
 
+    @Test
     public void testSimpleForm() throws Exception {
         AddressList addrList = parser.parseAddressList("\"a b c d e f g\" (comment) @example.net");
-        assertEquals(1, addrList.size());
-        Mailbox mailbox = (Mailbox)addrList.get(0);
-        assertEquals("a b c d e f g", mailbox.getLocalPart());
-        assertEquals("example.net", mailbox.getDomain());
+        Assert.assertEquals(1, addrList.size());
+        Mailbox mailbox = (Mailbox) addrList.get(0);
+        Assert.assertEquals("a b c d e f g", mailbox.getLocalPart());
+        Assert.assertEquals("example.net", mailbox.getDomain());
     }
 
+    @Test
     public void testFlatten() throws Exception {
         AddressList addrList = parser.parseAddressList("dev : one@example.com, two@example.com; , ,,, marketing:three@example.com ,four@example.com;, five@example.com");
-        assertEquals(3, addrList.size());
-        assertEquals(5, addrList.flatten().size());
+        Assert.assertEquals(3, addrList.size());
+        Assert.assertEquals(5, addrList.flatten().size());
     }
 
+    @Test
     public void testTortureTest() throws Exception {
 
         // Source: http://mailformat.dan.info/headers/from.html

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/contentdisposition/ContentDispositionTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/contentdisposition/ContentDispositionTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/contentdisposition/ContentDispositionTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/contentdisposition/ContentDispositionTest.java Thu Dec 27 13:23:54 2012
@@ -19,16 +19,17 @@
 
 package org.apache.james.mime4j.field.contentdisposition;
 
-import junit.framework.TestCase;
-
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.field.contentdisposition.parser.ParseException;
+import org.junit.Assert;
+import org.junit.Test;
 
-public class ContentDispositionTest extends TestCase {
+public class ContentDispositionTest {
 
+    @Test
     public void testExceptionTree() {
         // make sure that our ParseException extends MimeException.
-        assertTrue(MimeException.class.isAssignableFrom(ParseException.class));
+        Assert.assertTrue(MimeException.class.isAssignableFrom(ParseException.class));
     }
 
 }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/contenttype/ContentTypeTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/contenttype/ContentTypeTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/contenttype/ContentTypeTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/contenttype/ContentTypeTest.java Thu Dec 27 13:23:54 2012
@@ -22,18 +22,20 @@ package org.apache.james.mime4j.field.co
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.field.contenttype.parser.ContentTypeParser;
 import org.apache.james.mime4j.field.contenttype.parser.ParseException;
+import org.junit.Assert;
+import org.junit.Test;
 
 import java.io.StringReader;
 
-import junit.framework.TestCase;
-
-public class ContentTypeTest extends TestCase {
+public class ContentTypeTest {
 
+    @Test
     public void testExceptionTree() {
         // make sure that our ParseException extends MimeException.
-        assertTrue(MimeException.class.isAssignableFrom(ParseException.class));
+        Assert.assertTrue(MimeException.class.isAssignableFrom(ParseException.class));
     }
 
+    @Test
     public void testContentType() throws ParseException {
         test("one/two; three          =  four", "one", "two");
         test("one/(foo)two; three          =  \"four\"", "one", "two");
@@ -50,8 +52,8 @@ public class ContentTypeTest extends Tes
         String type = parser.getType();
         String subtype = parser.getSubType();
 
-        assertEquals(expectedType, type);
-        assertEquals(expectedSubtype, subtype);
+        Assert.assertEquals(expectedType, type);
+        Assert.assertEquals(expectedSubtype, subtype);
     }
 
 }

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/datetime/DateTimeTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/datetime/DateTimeTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/datetime/DateTimeTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/datetime/DateTimeTest.java Thu Dec 27 13:23:54 2012
@@ -19,87 +19,89 @@
 
 package org.apache.james.mime4j.field.datetime;
 
-import junit.framework.TestCase;
-
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.field.datetime.parser.DateTimeParser;
 import org.apache.james.mime4j.field.datetime.parser.ParseException;
+import org.junit.Assert;
+import org.junit.Test;
 
 import java.io.StringReader;
 
-public class DateTimeTest extends TestCase {
+public class DateTimeTest {
 
+    @Test
     public void testExceptionTree() {
         // make sure that our ParseException extends MimeException.
-        assertTrue(MimeException.class.isAssignableFrom(ParseException.class));
+        Assert.assertTrue(MimeException.class.isAssignableFrom(ParseException.class));
     }
 
+    @Test
     public void testNormalDate() throws ParseException {
         new DateTimeParser(new StringReader("Fri, 21 Nov 1997 09:55:06 -0600")).parseAll();
         new DateTimeParser(new StringReader("21 Nov 97 09:55:06 GMT")).parseAll();
 
 
-        ensureAllEqual(new String[] {
-           "Fri, 21 Nov 1997 09:55:06 -0600", // baseline
-           "Fri, 21 Nov 97 09:55:06 -0600",   // 2-digit year
-           "Fri, 21 Nov 097 09:55:06 -0600",  // 3-digit year
-           "Fri, 21 Nov 1997 10:55:06 -0500", // shift time zone
-           "Fri, 21 Nov 1997 19:25:06 +0330", // shift time zone
-           "21 Nov 1997 09:55:06 -0600"       // omit day of week
+        ensureAllEqual(new String[]{
+                "Fri, 21 Nov 1997 09:55:06 -0600", // baseline
+                "Fri, 21 Nov 97 09:55:06 -0600",   // 2-digit year
+                "Fri, 21 Nov 097 09:55:06 -0600",  // 3-digit year
+                "Fri, 21 Nov 1997 10:55:06 -0500", // shift time zone
+                "Fri, 21 Nov 1997 19:25:06 +0330", // shift time zone
+                "21 Nov 1997 09:55:06 -0600"       // omit day of week
         });
 
-        ensureAllEqual(new String[] {
-            "Thu, 16 Sep 2019 14:37:22 +0000", // baseline
-            "Thu, 16 Sep 19 14:37:22 +0000",   // 2-digit year
-            "Thu, 16 Sep 119 14:37:22 +0000",  // 3-digit year
-            "Thu, 16 Sep 2019 14:37:22 -0000", // minus-zero zone
-            "Thu, 16 Sep 2019 14:37:22 GMT",   // alternate zone
-            "Thu, 16 Sep 2019 14:37:22 UT"     // alternate zone
+        ensureAllEqual(new String[]{
+                "Thu, 16 Sep 2019 14:37:22 +0000", // baseline
+                "Thu, 16 Sep 19 14:37:22 +0000",   // 2-digit year
+                "Thu, 16 Sep 119 14:37:22 +0000",  // 3-digit year
+                "Thu, 16 Sep 2019 14:37:22 -0000", // minus-zero zone
+                "Thu, 16 Sep 2019 14:37:22 GMT",   // alternate zone
+                "Thu, 16 Sep 2019 14:37:22 UT"     // alternate zone
         });
 
-        ensureAllEqual(new String[] {
-            "Fri, 21 Nov 1997 12:00:00 GMT",
-            "Fri, 21 Nov 1997 07:00:00 EST",
-            "Fri, 21 Nov 1997 08:00:00 EDT",
-            "Fri, 21 Nov 1997 06:00:00 CST",
-            "Fri, 21 Nov 1997 07:00:00 CDT",
-            "Fri, 21 Nov 1997 05:00:00 MST",
-            "Fri, 21 Nov 1997 06:00:00 MDT",
-            "Fri, 21 Nov 1997 04:00:00 PST",
-            "Fri, 21 Nov 1997 05:00:00 PDT",
-
-            // make sure military zones are ignored, per RFC2822 instructions
-            "Fri, 21 Nov 1997 12:00:00 A",
-            "Fri, 21 Nov 1997 12:00:00 B",
-            "Fri, 21 Nov 1997 12:00:00 C",
-            "Fri, 21 Nov 1997 12:00:00 D",
-            "Fri, 21 Nov 1997 12:00:00 E",
-            "Fri, 21 Nov 1997 12:00:00 F",
-            "Fri, 21 Nov 1997 12:00:00 G",
-            "Fri, 21 Nov 1997 12:00:00 H",
-            "Fri, 21 Nov 1997 12:00:00 I",
-            "Fri, 21 Nov 1997 12:00:00 K",
-            "Fri, 21 Nov 1997 12:00:00 L",
-            "Fri, 21 Nov 1997 12:00:00 M",
-            "Fri, 21 Nov 1997 12:00:00 N",
-            "Fri, 21 Nov 1997 12:00:00 O",
-            "Fri, 21 Nov 1997 12:00:00 P",
-            "Fri, 21 Nov 1997 12:00:00 Q",
-            "Fri, 21 Nov 1997 12:00:00 R",
-            "Fri, 21 Nov 1997 12:00:00 S",
-            "Fri, 21 Nov 1997 12:00:00 T",
-            "Fri, 21 Nov 1997 12:00:00 U",
-            "Fri, 21 Nov 1997 12:00:00 V",
-            "Fri, 21 Nov 1997 12:00:00 W",
-            "Fri, 21 Nov 1997 12:00:00 X",
-            "Fri, 21 Nov 1997 12:00:00 Y",
-            "Fri, 21 Nov 1997 12:00:00 Z",
+        ensureAllEqual(new String[]{
+                "Fri, 21 Nov 1997 12:00:00 GMT",
+                "Fri, 21 Nov 1997 07:00:00 EST",
+                "Fri, 21 Nov 1997 08:00:00 EDT",
+                "Fri, 21 Nov 1997 06:00:00 CST",
+                "Fri, 21 Nov 1997 07:00:00 CDT",
+                "Fri, 21 Nov 1997 05:00:00 MST",
+                "Fri, 21 Nov 1997 06:00:00 MDT",
+                "Fri, 21 Nov 1997 04:00:00 PST",
+                "Fri, 21 Nov 1997 05:00:00 PDT",
+
+                // make sure military zones are ignored, per RFC2822 instructions
+                "Fri, 21 Nov 1997 12:00:00 A",
+                "Fri, 21 Nov 1997 12:00:00 B",
+                "Fri, 21 Nov 1997 12:00:00 C",
+                "Fri, 21 Nov 1997 12:00:00 D",
+                "Fri, 21 Nov 1997 12:00:00 E",
+                "Fri, 21 Nov 1997 12:00:00 F",
+                "Fri, 21 Nov 1997 12:00:00 G",
+                "Fri, 21 Nov 1997 12:00:00 H",
+                "Fri, 21 Nov 1997 12:00:00 I",
+                "Fri, 21 Nov 1997 12:00:00 K",
+                "Fri, 21 Nov 1997 12:00:00 L",
+                "Fri, 21 Nov 1997 12:00:00 M",
+                "Fri, 21 Nov 1997 12:00:00 N",
+                "Fri, 21 Nov 1997 12:00:00 O",
+                "Fri, 21 Nov 1997 12:00:00 P",
+                "Fri, 21 Nov 1997 12:00:00 Q",
+                "Fri, 21 Nov 1997 12:00:00 R",
+                "Fri, 21 Nov 1997 12:00:00 S",
+                "Fri, 21 Nov 1997 12:00:00 T",
+                "Fri, 21 Nov 1997 12:00:00 U",
+                "Fri, 21 Nov 1997 12:00:00 V",
+                "Fri, 21 Nov 1997 12:00:00 W",
+                "Fri, 21 Nov 1997 12:00:00 X",
+                "Fri, 21 Nov 1997 12:00:00 Y",
+                "Fri, 21 Nov 1997 12:00:00 Z",
         });
     }
 
     private void ensureAllEqual(String[] dateStrings) throws ParseException {
         for (int i = 0; i < dateStrings.length - 1; i++) {
-            assertEquals(
+            Assert.assertEquals(
                     new DateTimeParser(new StringReader(dateStrings[i])).parseAll().getDate().getTime(),
                     new DateTimeParser(new StringReader(dateStrings[i + 1])).parseAll().getDate().getTime()
             );

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/mimeversion/MimeVersionParserTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/mimeversion/MimeVersionParserTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/mimeversion/MimeVersionParserTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/mimeversion/MimeVersionParserTest.java Thu Dec 27 13:23:54 2012
@@ -19,25 +19,16 @@
 
 package org.apache.james.mime4j.field.mimeversion;
 
-import java.io.StringReader;
-
-import junit.framework.TestCase;
-
 import org.apache.james.mime4j.field.mimeversion.parser.MimeVersionParser;
 import org.apache.james.mime4j.field.mimeversion.parser.ParseException;
+import org.junit.Assert;
+import org.junit.Test;
 
-public class MimeVersionParserTest extends TestCase {
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
+import java.io.StringReader;
 
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
+public class MimeVersionParserTest {
 
+    @Test
     public void testPlainLine() throws Exception {
         check("2.4", 2, 4);
         check("25.344", 25, 344);
@@ -45,6 +36,7 @@ public class MimeVersionParserTest exten
         check("123234234.0", 123234234, 0);
     }
 
+    @Test
     public void testLineWithComments() throws Exception {
         check("2(A comment).4", 2, 4);
         check("2(.8).4", 2, 4);
@@ -53,14 +45,16 @@ public class MimeVersionParserTest exten
         check("2.(A comment)4", 2, 4);
     }
 
+    @Test
     public void testLineWithNestedComments() throws Exception {
         check("2(4.45 ( Another ()comment () blah (Wobble(mix)))Whatever).4", 2, 4);
     }
 
+    @Test
     public void testEmptyLine() throws Exception {
         try {
             parse("(This is just a comment)");
-            fail("Expected exception to be thrown");
+            Assert.fail("Expected exception to be thrown");
         } catch (ParseException e) {
             //expected
         }
@@ -68,8 +62,8 @@ public class MimeVersionParserTest exten
 
     private void check(String input, int expectedMajorVersion, int expectedMinorVersion) throws Exception {
         MimeVersionParser parser = parse(input);
-        assertEquals("Major version number", expectedMajorVersion, parser.getMajorVersion());
-        assertEquals("Minor version number", expectedMinorVersion, parser.getMinorVersion());
+        Assert.assertEquals("Major version number", expectedMajorVersion, parser.getMajorVersion());
+        Assert.assertEquals("Minor version number", expectedMinorVersion, parser.getMinorVersion());
     }
 
     private MimeVersionParser parse(String input) throws ParseException {

Modified: james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/structured/StructuredFieldParserTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/structured/StructuredFieldParserTest.java?rev=1426193&r1=1426192&r2=1426193&view=diff
==============================================================================
--- james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/structured/StructuredFieldParserTest.java (original)
+++ james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/structured/StructuredFieldParserTest.java Thu Dec 27 13:23:54 2012
@@ -19,52 +19,48 @@
 
 package org.apache.james.mime4j.field.structured;
 
-import java.io.StringReader;
-
-import junit.framework.TestCase;
-
 import org.apache.james.mime4j.field.structured.parser.StructuredFieldParser;
+import org.junit.Assert;
+import org.junit.Test;
 
-public class StructuredFieldParserTest extends TestCase {
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
+import java.io.StringReader;
 
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
+public class StructuredFieldParserTest {
 
+    @Test
     public void testSimpleField() throws Exception {
         final String string = "Field Value";
-        assertEquals(string, parse(string));
+        Assert.assertEquals(string, parse(string));
     }
 
+    @Test
     public void testTrim() throws Exception {
         final String string = "Field Value";
-        assertEquals(string, parse("    \t\r\n" + string + "  \t\r\n  "));
+        Assert.assertEquals(string, parse("    \t\r\n" + string + "  \t\r\n  "));
     }
 
+    @Test
     public void testFolding() throws Exception {
-        assertEquals("Field Value", parse("Field \t\r\n  Value"));
+        Assert.assertEquals("Field Value", parse("Field \t\r\n  Value"));
     }
 
+    @Test
     public void testQuotedString() throws Exception {
-        assertEquals("Field    Value", parse("\"Field    Value\""));
-        assertEquals("Field\t\r\nValue", parse("\"Field\t\r\nValue\""));
-        assertEquals("Field\t\r\nValue", parse("\"Field\t\r\n       \t       Value\""));
+        Assert.assertEquals("Field    Value", parse("\"Field    Value\""));
+        Assert.assertEquals("Field\t\r\nValue", parse("\"Field\t\r\nValue\""));
+        Assert.assertEquals("Field\t\r\nValue", parse("\"Field\t\r\n       \t       Value\""));
     }
 
+    @Test
     public void testComments() throws Exception {
-        assertEquals("Field", parse("Fi(This is a comment)eld"));
-        assertEquals("Field Value", parse("Fi(This is a comment)eld (A (very (nested) )comment)Value"));
+        Assert.assertEquals("Field", parse("Fi(This is a comment)eld"));
+        Assert.assertEquals("Field Value", parse("Fi(This is a comment)eld (A (very (nested) )comment)Value"));
     }
 
+    @Test
     public void testQuotedInComments() throws Exception {
-        assertEquals("Fi(This is a comment)eld", parse("\"Fi(This is a comment)eld\""));
-        assertEquals("Field Value", parse("Fi(This is a comment)eld (A (very (nested) )comment)Value"));
+        Assert.assertEquals("Fi(This is a comment)eld", parse("\"Fi(This is a comment)eld\""));
+        Assert.assertEquals("Field Value", parse("Fi(This is a comment)eld (A (very (nested) )comment)Value"));
     }
 
     private String parse(String in) throws Exception {



Mime
View raw message