james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1470968 - in /james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address: DefaultAddressBuilderTest.java LenientAddressBuilderTest.java
Date Tue, 23 Apr 2013 14:01:58 GMT
Author: olegk
Date: Tue Apr 23 14:01:58 2013
New Revision: 1470968

URL: http://svn.apache.org/r1470968
Log:
MIME4J-229: test cases

Modified:
    james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/DefaultAddressBuilderTest.java
    james/mime4j/trunk/dom/src/test/java/org/apache/james/mime4j/field/address/LenientAddressBuilderTest.java

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=1470968&r1=1470967&r2=1470968&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
Tue Apr 23 14:01:58 2013
@@ -279,6 +279,19 @@ public class DefaultAddressBuilderTest {
     }
 
     @Test
+    public void testParseAddressWithQuotedEmailAddressInName() throws Exception {
+        Address address = parser.parseAddress("\"test@test.com\" <test@test.com>");
+        Assert.assertTrue(address instanceof Mailbox);
+        Assert.assertEquals("test@test.com", ((Mailbox) address).getName());
+        Assert.assertEquals("test@test.com", ((Mailbox) address).getAddress());
+    }
+
+    @Test(expected=ParseException.class)
+    public void testParseAddressWithUnquotedEmailAddressInName() throws Exception {
+        parser.parseAddress("test@test.com <test@test.com>");
+    }
+
+    @Test
     public void testParseInvalidAddress() throws Exception {
         try {
             parser.parseGroup("john.doe@acme.org, jane.doe@acme.org");

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=1470968&r1=1470967&r2=1470968&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
Tue Apr 23 14:01:58 2013
@@ -314,6 +314,21 @@ public class LenientAddressBuilderTest {
     }
 
     @Test
+    public void testParseAddressWithQuotedEmailAddressInName() throws Exception {
+        Address address = parser.parseAddress("\"test@test.com\" <test@test.com>");
+        Assert.assertTrue(address instanceof Mailbox);
+        Assert.assertEquals("test@test.com", ((Mailbox) address).getName());
+        Assert.assertEquals("test@test.com", ((Mailbox) address).getAddress());
+    }
+
+    @Test
+    public void testParseAddressWithUnquotedEmailAddressInName() throws Exception {
+        Address address = parser.parseAddress("test@test.com <test@test.com>");
+        Assert.assertTrue(address instanceof Mailbox);
+        Assert.assertEquals("test@test.com<test@test.com>", ((Mailbox) address).getAddress());
+    }
+
+    @Test
     public void testParseAddressList() throws Exception {
         AddressList addrList1 = parser.parseAddressList("John Doe <jdoe@machine(comment).
 example>");
         Assert.assertEquals(1, addrList1.size());



Mime
View raw message