james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [23/44] james-project git commit: JAMES-2267 Make FakeMail builder a bit more fluent
Date Fri, 05 Jan 2018 03:01:07 GMT
JAMES-2267 Make FakeMail builder a bit more fluent


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/ca7051aa
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/ca7051aa
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/ca7051aa

Branch: refs/heads/master
Commit: ca7051aa9c3a97d2d6db9c8e5bbc499dca4cfe91
Parents: 2da49b9
Author: benwa <btellier@linagora.com>
Authored: Tue Dec 19 17:43:52 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Fri Jan 5 09:33:19 2018 +0700

----------------------------------------------------------------------
 .../AutomaticallySentMailDetectorImplTest.java  |  35 ++--
 .../org/apache/mailet/base/test/FakeMail.java   |  16 ++
 .../mailet/base/test/FakeMailContext.java       |  10 ++
 .../transport/mailets/ContactExtractorTest.java |  43 +++--
 .../james/transport/mailets/LogMessageTest.java |   5 +-
 .../mailets/RecipientToLowerCaseTest.java       |   2 +-
 .../transport/matchers/HasMimeTypeTest.java     |  13 +-
 .../transport/matchers/SenderIsNullTest.java    |   3 +-
 .../transport/matchers/SenderIsRegexTest.java   |   6 +-
 .../james/transport/matchers/SenderIsTest.java  |   4 +-
 .../matchers/TooManyRecipientsTest.java         |   9 +-
 .../mailets/AmqpForwardAttachmentTest.java      |  13 +-
 .../transport/mailets/ContactExtractorTest.java |  11 +-
 .../transport/mailets/GroupMappingTest.java     | 168 +++++++------------
 .../mailets/ICSAttachmentWorkflowTest.java      | 126 ++++++--------
 .../transport/mailets/StripAttachmentTest.java  |  13 +-
 .../james/transport/mailets/DSNBounceTest.java  |  26 +--
 .../mailets/delivery/LocalDeliveryTest.java     |   2 +-
 .../mailets/delivery/SieveIntegrationTest.java  |  12 +-
 .../mailets/delivery/ToRecipientFolderTest.java |   2 +-
 .../managesieve/ManageSieveMailetTestCase.java  |   4 +-
 .../matchers/InSpammerBlacklistTest.java        |   4 +-
 .../integration/SetMessagesMethodTest.java      |   5 +-
 .../james/jmap/mailet/VacationMailetTest.java   |   4 +-
 server/testing/pom.xml                          |   5 +
 .../apache/james/utils/SMTPMessageSender.java   |   5 +
 26 files changed, 239 insertions(+), 307 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/mailet/base/src/test/java/org/apache/mailet/base/AutomaticallySentMailDetectorImplTest.java
----------------------------------------------------------------------
diff --git a/mailet/base/src/test/java/org/apache/mailet/base/AutomaticallySentMailDetectorImplTest.java b/mailet/base/src/test/java/org/apache/mailet/base/AutomaticallySentMailDetectorImplTest.java
index c99ff14..6e2c135 100644
--- a/mailet/base/src/test/java/org/apache/mailet/base/AutomaticallySentMailDetectorImplTest.java
+++ b/mailet/base/src/test/java/org/apache/mailet/base/AutomaticallySentMailDetectorImplTest.java
@@ -32,7 +32,6 @@ import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMultipart;
 import javax.mail.util.ByteArrayDataSource;
 
-import org.apache.james.core.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.MimeMessageBuilder;
 import org.junit.Test;
@@ -62,7 +61,7 @@ public class AutomaticallySentMailDetectorImplTest {
     @Test
     public void ownerIsAMailingListPrefix() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("owner-list@any.com"))
+                .sender("owner-list@any.com")
                 .build();
 
         assertThat(new AutomaticallySentMailDetectorImpl().isMailingList(fakeMail)).isTrue();
@@ -71,7 +70,7 @@ public class AutomaticallySentMailDetectorImplTest {
     @Test
     public void requestIsAMailingListPrefix() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("list-request@any.com"))
+                .sender("list-request@any.com")
                 .build();
 
         assertThat(new AutomaticallySentMailDetectorImpl().isMailingList(fakeMail)).isTrue();
@@ -80,7 +79,7 @@ public class AutomaticallySentMailDetectorImplTest {
     @Test
     public void mailerDaemonIsReserved() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("MAILER-DAEMON@any.com"))
+                .sender("MAILER-DAEMON@any.com")
                 .build();
 
         assertThat(new AutomaticallySentMailDetectorImpl().isMailingList(fakeMail)).isTrue();
@@ -89,7 +88,7 @@ public class AutomaticallySentMailDetectorImplTest {
     @Test
     public void listservIsReserved() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("LISTSERV@any.com"))
+                .sender("LISTSERV@any.com")
                 .build();
 
         assertThat(new AutomaticallySentMailDetectorImpl().isMailingList(fakeMail)).isTrue();
@@ -98,7 +97,7 @@ public class AutomaticallySentMailDetectorImplTest {
     @Test
     public void majordomoIsReserved() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("majordomo@any.com"))
+                .sender("majordomo@any.com")
                 .build();
 
         assertThat(new AutomaticallySentMailDetectorImpl().isMailingList(fakeMail)).isTrue();
@@ -109,7 +108,7 @@ public class AutomaticallySentMailDetectorImplTest {
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
         message.setHeader("List-Id", "any");
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("any@any.com"))
+                .sender("any@any.com")
                 .mimeMessage(message)
                 .build();
 
@@ -121,7 +120,7 @@ public class AutomaticallySentMailDetectorImplTest {
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
         message.setHeader("List-Help", "any");
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("any@any.com"))
+                .sender("any@any.com")
                 .mimeMessage(message)
                 .build();
 
@@ -133,7 +132,7 @@ public class AutomaticallySentMailDetectorImplTest {
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
         message.setHeader("List-Subscribe", "any");
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("any@any.com"))
+                .sender("any@any.com")
                 .mimeMessage(message)
                 .build();
 
@@ -145,7 +144,7 @@ public class AutomaticallySentMailDetectorImplTest {
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
         message.setHeader("List-Unsubscribe", "any");
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("any@any.com"))
+                .sender("any@any.com")
                 .mimeMessage(message)
                 .build();
 
@@ -157,7 +156,7 @@ public class AutomaticallySentMailDetectorImplTest {
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
         message.setHeader("List-Post", "any");
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("any@any.com"))
+                .sender("any@any.com")
                 .mimeMessage(message)
                 .build();
 
@@ -169,7 +168,7 @@ public class AutomaticallySentMailDetectorImplTest {
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
         message.setHeader("List-Owner", "any");
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("any@any.com"))
+                .sender("any@any.com")
                 .mimeMessage(message)
                 .build();
 
@@ -181,7 +180,7 @@ public class AutomaticallySentMailDetectorImplTest {
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
         message.setHeader("List-Archive", "any");
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("any@any.com"))
+                .sender("any@any.com")
                 .mimeMessage(message)
                 .build();
 
@@ -191,7 +190,7 @@ public class AutomaticallySentMailDetectorImplTest {
     @Test
     public void normalMailShouldNotBeIdentifiedAsMailingList() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("any@any.com"))
+                .sender("any@any.com")
                 .mimeMessage(new MimeMessage(Session.getDefaultInstance(new Properties())))
                 .build();
 
@@ -212,7 +211,7 @@ public class AutomaticallySentMailDetectorImplTest {
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
         message.setHeader("Auto-Submitted", "auto-replied");
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("any@any.com"))
+                .sender("any@any.com")
                 .mimeMessage(message)
                 .build();
 
@@ -235,7 +234,7 @@ public class AutomaticallySentMailDetectorImplTest {
         message.setContent(multipart);
         
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("any@any.com"))
+                .sender("any@any.com")
                 .mimeMessage(message)
                 .build();
 
@@ -258,7 +257,7 @@ public class AutomaticallySentMailDetectorImplTest {
         message.setContent(multipart);
         
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("any@any.com"))
+                .sender("any@any.com")
                 .mimeMessage(message)
                 .build();
 
@@ -281,7 +280,7 @@ public class AutomaticallySentMailDetectorImplTest {
         message.setContent(multipart);
         
         FakeMail fakeMail = FakeMail.builder()
-                .sender(new MailAddress("any@any.com"))
+                .sender("any@any.com")
                 .mimeMessage(message)
                 .build();
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMail.java
----------------------------------------------------------------------
diff --git a/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMail.java b/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMail.java
index beee826..90acb0d 100644
--- a/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMail.java
+++ b/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMail.java
@@ -23,6 +23,7 @@ package org.apache.mailet.base.test;
 import java.io.ByteArrayInputStream;
 import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
 import java.util.Iterator;
@@ -33,6 +34,7 @@ import java.util.Properties;
 
 import javax.mail.MessagingException;
 import javax.mail.Session;
+import javax.mail.internet.AddressException;
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeMessage;
 
@@ -41,6 +43,7 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.PerRecipientHeaders;
 import org.apache.mailet.PerRecipientHeaders.Header;
 
+import com.github.fge.lambdas.Throwing;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;
@@ -148,11 +151,20 @@ public class FakeMail implements Mail {
             return this;
         }
 
+        public Builder recipients(String... recipients) {
+            Arrays.stream(recipients).forEach(Throwing.consumer(this::recipient));
+            return this;
+        }
+
         public Builder recipient(MailAddress recipient) {
             this.recipients.add(recipient);
             return this;
         }
 
+        public Builder recipient(String recipient) throws AddressException {
+            return recipient(new MailAddress(recipient));
+        }
+
         public Builder name(String name) {
             this.name = Optional.of(name);
             return this;
@@ -163,6 +175,10 @@ public class FakeMail implements Mail {
             return this;
         }
 
+        public Builder sender(String sender) throws AddressException {
+            return sender(new MailAddress(sender));
+        }
+
         public Builder state(String state) {
             this.state = Optional.of(state);
             return this;

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailContext.java
----------------------------------------------------------------------
diff --git a/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailContext.java b/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailContext.java
index 9489dbe..f7d279b 100644
--- a/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailContext.java
+++ b/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailContext.java
@@ -31,6 +31,7 @@ import java.util.Optional;
 import java.util.concurrent.TimeUnit;
 
 import javax.mail.MessagingException;
+import javax.mail.internet.AddressException;
 import javax.mail.internet.MimeMessage;
 
 import org.apache.james.core.MailAddress;
@@ -120,6 +121,10 @@ public class FakeMailContext implements MailetContext {
                 return this;
             }
 
+            public Builder sender(String sender) throws AddressException {
+                return sender(new MailAddress(sender));
+            }
+
             public Builder recipients(Collection<MailAddress> recipients) {
                 this.recipients = Optional.of(recipients);
                 return this;
@@ -140,6 +145,11 @@ public class FakeMailContext implements MailetContext {
                 return recipients(ImmutableList.of(recipient));
             }
 
+            public Builder recipient(String recipient) throws AddressException {
+                Preconditions.checkNotNull(recipient);
+                return recipients(new MailAddress(recipient));
+            }
+
             public Builder message(MimeMessage mimeMessage) {
                 this.msg = mimeMessage;
                 return this;

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java b/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
index 99b04f4..c6f1c41 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
@@ -28,7 +28,6 @@ import static org.mockito.Mockito.when;
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
 
-import org.apache.james.core.MailAddress;
 import org.apache.mailet.MailetContext;
 import org.apache.mailet.MailetException;
 import org.apache.mailet.base.test.FakeMail;
@@ -87,8 +86,8 @@ public class ContactExtractorTest {
     @Test
     public void serviceShouldNotThrowWhenJsonProcessingFails() throws Exception {
         FakeMail mail = FakeMail.builder().mimeMessage(MimeMessageBuilder.defaultMimeMessage())
-                .sender(new MailAddress(SENDER))
-                .recipient(new MailAddress(TO))
+                .sender(SENDER)
+                .recipient(TO)
                 .build();
 
         ObjectMapper objectMapper = mock(ObjectMapper.class);
@@ -109,8 +108,8 @@ public class ContactExtractorTest {
                 .setSubject("Contact collection Rocks")
                 .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(TO))
+            .sender(SENDER)
+            .recipient(TO)
             .build();
         mailet.init(mailetConfig);
 
@@ -128,8 +127,8 @@ public class ContactExtractorTest {
             .setSubject("Contact collection Rocks")
             .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(TO))
+            .sender(SENDER)
+            .recipient(TO)
             .build();
         mailet.init(mailetConfig);
 
@@ -147,8 +146,8 @@ public class ContactExtractorTest {
             .setSubject("Contact collection Rocks")
             .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(TO))
+            .sender(SENDER)
+            .recipient(TO)
             .build();
         mailet.init(mailetConfig);
 
@@ -167,8 +166,8 @@ public class ContactExtractorTest {
             + "Please!";
         MimeMessage message = MimeMessageBuilder.mimeMessageFromBytes(rawMessage.getBytes());
         FakeMail mail = FakeMail.builder().mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress("frecipient@example.com"))
+            .sender(SENDER)
+            .recipient("recipient@example.com")
             .build();
         mailet.init(mailetConfig);
 
@@ -187,8 +186,8 @@ public class ContactExtractorTest {
             + "Please!";
         MimeMessage message = MimeMessageBuilder.mimeMessageFromBytes(rawMessage.getBytes());
         FakeMail mail = FakeMail.builder().mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress("frecipient@example.com"))
+            .sender(SENDER)
+            .recipient("recipient@example.com")
             .build();
         mailet.init(mailetConfig);
 
@@ -207,8 +206,8 @@ public class ContactExtractorTest {
             + "Please!";
         MimeMessage message = MimeMessageBuilder.mimeMessageFromBytes(rawMessage.getBytes());
         FakeMail mail = FakeMail.builder().mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress("frecipient@example.com"))
+            .sender(SENDER)
+            .recipient("recipient@example.com")
             .build();
         mailet.init(mailetConfig);
 
@@ -226,8 +225,8 @@ public class ContactExtractorTest {
             .setSubject("Contact collection Rocks")
             .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(TO))
+            .sender(SENDER)
+            .recipient(TO)
             .build();
         mailet.init(mailetConfig);
 
@@ -245,8 +244,8 @@ public class ContactExtractorTest {
             .setSubject("Contact collection Rocks")
             .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(TO))
+            .sender(SENDER)
+            .recipient(TO)
             .build();
         mailet.init(mailetConfig);
 
@@ -263,7 +262,7 @@ public class ContactExtractorTest {
             .setSubject("Contact collection Rocks")
             .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
-            .recipient(new MailAddress(TO))
+            .recipient(TO)
             .build();
         mailet.init(mailetConfig);
 
@@ -279,7 +278,7 @@ public class ContactExtractorTest {
                 .setSubject("Contact collection Rocks")
                 .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
-            .sender(new MailAddress(SENDER))
+            .sender(SENDER)
             .build();
         mailet.init(mailetConfig);
 
@@ -295,7 +294,7 @@ public class ContactExtractorTest {
                 .setSubject("Contact collection Rocks")
                 .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
-            .sender(new MailAddress(SENDER))
+            .sender(SENDER)
             .build();
 
         mailet.extractContacts(mail);

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/mailet/standard/src/test/java/org/apache/james/transport/mailets/LogMessageTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/mailets/LogMessageTest.java b/mailet/standard/src/test/java/org/apache/james/transport/mailets/LogMessageTest.java
index 41dc494..14b08da 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/mailets/LogMessageTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/mailets/LogMessageTest.java
@@ -38,7 +38,6 @@ import javax.mail.internet.AddressException;
 import javax.mail.internet.MimeMessage;
 
 import org.apache.mailet.Mail;
-import org.apache.james.core.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
@@ -262,8 +261,8 @@ public class LogMessageTest {
                 .mimeMessage(message)
                 .name("name")
                 .state(Mail.DEFAULT)
-                .recipient(new MailAddress("receiver@domain.com"))
-                .sender(new MailAddress("sender@any.com"))
+                .recipient("receiver@domain.com")
+                .sender("sender@any.com")
                 .build();
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/mailet/standard/src/test/java/org/apache/james/transport/mailets/RecipientToLowerCaseTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RecipientToLowerCaseTest.java b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RecipientToLowerCaseTest.java
index ed1d4b7..49762c6 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RecipientToLowerCaseTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RecipientToLowerCaseTest.java
@@ -40,7 +40,7 @@ public class RecipientToLowerCaseTest {
     @Test
     public void serviceShouldPutRecipientToLowerCase() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
-            .recipient(new MailAddress("THienan1234@gmail.com"))
+            .recipient("THienan1234@gmail.com")
             .build();
 
         testee.service(fakeMail);

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMimeTypeTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMimeTypeTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMimeTypeTest.java
index f6ab324..97aa9cc 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMimeTypeTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMimeTypeTest.java
@@ -21,7 +21,6 @@ package org.apache.james.transport.matchers;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import org.apache.james.core.MailAddress;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMatcherConfig;
@@ -66,8 +65,8 @@ public class HasMimeTypeTest {
 
         Mail mail = FakeMail.builder()
             .mimeMessage(message)
-            .sender(new MailAddress(FROM))
-            .recipient(new MailAddress(RECIPIENT))
+            .sender(FROM)
+            .recipient(RECIPIENT)
             .build();
 
         assertThat(matcher.match(mail)).containsAll(mail.getRecipients());
@@ -96,8 +95,8 @@ public class HasMimeTypeTest {
 
         Mail mail = FakeMail.builder()
             .mimeMessage(message)
-            .sender(new MailAddress(FROM))
-            .recipient(new MailAddress(RECIPIENT))
+            .sender(FROM)
+            .recipient(RECIPIENT)
             .build();
 
         assertThat(matcher.match(mail)).isEmpty();
@@ -116,8 +115,8 @@ public class HasMimeTypeTest {
 
         Mail mail = FakeMail.builder()
             .mimeMessage(message)
-            .sender(new MailAddress(FROM))
-            .recipient(new MailAddress(RECIPIENT))
+            .sender(FROM)
+            .recipient(RECIPIENT)
             .build();
 
         assertThat(matcher.match(mail)).containsExactlyElementsOf(mail.getRecipients());

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsNullTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsNullTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsNullTest.java
index 8241b64..1c2b429 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsNullTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsNullTest.java
@@ -23,7 +23,6 @@ package org.apache.james.transport.matchers;
 import static org.apache.mailet.base.MailAddressFixture.ANY_AT_JAMES;
 import static org.assertj.core.api.Assertions.assertThat;
 
-import org.apache.james.core.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
@@ -59,7 +58,7 @@ public class SenderIsNullTest {
     public void shouldNotMatchWhenSenderIsPresent() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
             .recipient(ANY_AT_JAMES)
-            .sender(new MailAddress("other@james.apache.org"))
+            .sender("other@james.apache.org")
             .build();
 
         assertThat(matcher.match(fakeMail)).isNull();

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsRegexTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsRegexTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsRegexTest.java
index 114dc26..f5668fb 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsRegexTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsRegexTest.java
@@ -55,7 +55,7 @@ public class SenderIsRegexTest {
                 .build());
 
         FakeMail fakeMail = FakeMail.builder()
-            .sender(new MailAddress(SENDER_NAME))
+            .sender(SENDER_NAME)
             .recipient(recipient)
             .build();
 
@@ -70,7 +70,7 @@ public class SenderIsRegexTest {
                 .build());
 
         FakeMail fakeMail = FakeMail.builder()
-            .sender(new MailAddress(SENDER_NAME))
+            .sender(SENDER_NAME)
             .recipient(recipient)
             .build();
 
@@ -99,7 +99,7 @@ public class SenderIsRegexTest {
                 .build());
 
         FakeMail fakeMail = FakeMail.builder()
-            .sender(new MailAddress(SENDER_NAME))
+            .sender(SENDER_NAME)
             .recipient(recipient)
             .build();
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsTest.java
index 1c7b823..45f4242 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsTest.java
@@ -57,7 +57,7 @@ public class SenderIsTest {
 
         FakeMail fakeMail = FakeMail.builder()
             .recipient(recipient)
-            .sender(new MailAddress(SENDER_NAME))
+            .sender(SENDER_NAME)
             .build();
 
         assertThat(matcher.match(fakeMail)).containsExactly(recipient);
@@ -72,7 +72,7 @@ public class SenderIsTest {
 
         FakeMail fakeMail = FakeMail.builder()
             .recipient(recipient)
-            .sender(new MailAddress("other@james.apache.org"))
+            .sender("other@james.apache.org")
             .build();
 
         assertThat(matcher.match(fakeMail)).isNull();

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyRecipientsTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyRecipientsTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyRecipientsTest.java
index 41ee23a..766d0dd 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyRecipientsTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyRecipientsTest.java
@@ -116,7 +116,7 @@ public class TooManyRecipientsTest {
             .build());
 
         FakeMail fakeMail = FakeMail.builder()
-            .recipient(new MailAddress("cuong.tran@gmail.com"))
+            .recipient("cuong.tran@gmail.com")
             .build();
 
         Collection<MailAddress> result = testee.match(fakeMail);
@@ -132,13 +132,8 @@ public class TooManyRecipientsTest {
             .matcherName("matcherName")
             .build());
 
-        ImmutableList<MailAddress> mailAddresses = ImmutableList.of(
-            new MailAddress("cuong.tran@gmail.com"),
-            new MailAddress("suu.tran@gmail.com"),
-            new MailAddress("tuan.tran@gmail.com"));
-
         FakeMail fakeMail = FakeMail.builder()
-            .recipients(mailAddresses)
+            .recipients("cuong.tran@gmail.com", "suu.tran@gmail.com", "tuan.tran@gmail.com")
             .build();
 
         Collection<MailAddress> result = testee.match(fakeMail);

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
index 550dd1d..2db87c7 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
@@ -31,7 +31,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.nio.charset.StandardCharsets;
 
 import org.apache.james.MemoryJamesServerMain;
-import org.apache.james.core.MailAddress;
 import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.CommonProcessors;
@@ -48,7 +47,6 @@ import org.apache.james.util.docker.SwarmGenericContainer;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.IMAPMessageReader;
 import org.apache.james.utils.SMTPMessageSender;
-import org.apache.mailet.Mail;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.MimeMessageBuilder;
 import org.junit.After;
@@ -140,14 +138,11 @@ public class AmqpForwardAttachmentTest {
                     .filename("test.txt"))
             .setSubject("test");
 
-        Mail mail = FakeMail.builder()
-              .mimeMessage(message)
-              .sender(new MailAddress(FROM))
-              .recipient(new MailAddress(RECIPIENT))
-              .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(FROM)
+                .recipient(RECIPIENT))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
index 55d779d..bd4de44 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
@@ -31,7 +31,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.util.Optional;
 
 import org.apache.james.MemoryJamesServerMain;
-import org.apache.james.core.MailAddress;
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
@@ -132,14 +131,12 @@ public class ContactExtractorTest {
             .addBccRecipient(BCC, "John Bcc2 <" + BCC2 + ">")
             .setSubject("Contact collection Rocks")
             .setText("This is my email");
-        FakeMail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipients(new MailAddress(TO), new MailAddress(TO2), new MailAddress(CC), new MailAddress(CC2), new MailAddress(BCC), new MailAddress(BCC2))
-            .build();
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
             .authenticate(SENDER, PASSWORD)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipients(TO, TO2, CC, CC2, BCC, BCC2))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java
index c4c5ae7..c672f85 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java
@@ -35,7 +35,6 @@ import java.util.concurrent.TimeUnit;
 
 import javax.mail.internet.MimeMessage;
 
-import org.apache.james.core.MailAddress;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.InMemoryDNSService;
 import org.apache.james.jmap.mailet.VacationMailet;
@@ -57,7 +56,6 @@ import org.apache.james.utils.IMAPMessageReader;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.routes.GroupsRoutes;
-import org.apache.mailet.Mail;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.MimeMessageBuilder;
 import org.junit.After;
@@ -179,14 +177,11 @@ public class GroupMappingTest {
     public void messageShouldRedirectToUserWhenBelongingToGroup() throws Exception {
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN1 + "/" + USER_DOMAIN1);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(GROUP_ON_DOMAIN1))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -200,14 +195,11 @@ public class GroupMappingTest {
     public void messageShouldRedirectToUserDoesNotHaveSameDomainWhenBelongingToGroup() throws Exception {
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN1 + "/" + USER_DOMAIN2);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(GROUP_ON_DOMAIN1))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -223,17 +215,13 @@ public class GroupMappingTest {
 
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN1 + "/" + USER_DOMAIN2);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(GROUP_ON_DOMAIN1))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
-
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
             .login(USER_DOMAIN1, PASSWORD)
             .select(IMAPMessageReader.INBOX)
@@ -250,14 +238,11 @@ public class GroupMappingTest {
 
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN1 + "/" + GROUP_ON_DOMAIN2);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(GROUP_ON_DOMAIN1))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -275,14 +260,11 @@ public class GroupMappingTest {
 
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN1 + "/" + GROUP_ON_DOMAIN2);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(GROUP_ON_DOMAIN1))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -295,14 +277,11 @@ public class GroupMappingTest {
     public void messageShouldNotBeDuplicatedWhenRecipientIsAlsoPartOfGroup() throws Exception {
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN1 + "/" + USER_DOMAIN1);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipients(new MailAddress(GROUP_ON_DOMAIN1), new MailAddress(USER_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipients(GROUP_ON_DOMAIN1, USER_DOMAIN1))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -319,14 +298,11 @@ public class GroupMappingTest {
 
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN1 + "/" + GROUP_ON_DOMAIN2);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN2))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage( FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(GROUP_ON_DOMAIN2))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -350,14 +326,11 @@ public class GroupMappingTest {
 
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN2 + "/" + GROUP_ON_DOMAIN1);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(GROUP_ON_DOMAIN1))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -377,14 +350,11 @@ public class GroupMappingTest {
 
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN1 + "/" + USER_DOMAIN1);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(GROUP_ON_DOMAIN1))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -399,14 +369,11 @@ public class GroupMappingTest {
 
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN1 + "/" + USER_DOMAIN1);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(GROUP_ON_DOMAIN1))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -421,14 +388,11 @@ public class GroupMappingTest {
 
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN2 + "/" + USER_DOMAIN2);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient((GROUP_ON_DOMAIN1)))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -443,14 +407,11 @@ public class GroupMappingTest {
         String groupWithEncodedSlash = "a%2Fa@" + DOMAIN1;
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + groupWithEncodedSlash + "/" + USER_DOMAIN1);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(groupWithSlash))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(groupWithSlash))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -466,14 +427,11 @@ public class GroupMappingTest {
         String userWithEncodedSlash = "a%2Fa@" + DOMAIN1;
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN1 + "/" + userWithEncodedSlash);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(GROUP_ON_DOMAIN1))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -488,14 +446,11 @@ public class GroupMappingTest {
         String groupWithEncodedAt = "group%40" + DOMAIN1;
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + groupWithEncodedAt + "/" + userWithEncodedAt);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(GROUP_ON_DOMAIN1))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -509,14 +464,11 @@ public class GroupMappingTest {
         String externalMail = "ray@yopmail.com";
         restApiRequest.put(GroupsRoutes.ROOT_PATH + "/" + GROUP_ON_DOMAIN1 + "/" + externalMail);
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .sender(new MailAddress(SENDER))
-            .recipient(new MailAddress(GROUP_ON_DOMAIN1))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(SENDER)
+                .recipient(GROUP_ON_DOMAIN1))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         calmlyAwait.atMost(1, TimeUnit.MINUTES)

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
index c70df91..76640b2 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
@@ -34,7 +34,6 @@ import java.util.Optional;
 import javax.mail.internet.MimeMessage;
 
 import org.apache.james.MemoryJamesServerMain;
-import org.apache.james.core.MailAddress;
 import org.apache.james.jmap.mailet.TextCalendarBodyToAttachment;
 import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailets.TemporaryJamesServer;
@@ -52,7 +51,6 @@ import org.apache.james.util.docker.SwarmGenericContainer;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.IMAPMessageReader;
 import org.apache.james.utils.SMTPMessageSender;
-import org.apache.mailet.Mail;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.MimeMessageBuilder;
 import org.junit.After;
@@ -567,35 +565,28 @@ public class ICSAttachmentWorkflowTest {
 
     @Test
     public void calendarAttachmentShouldNotBePublishedInMQWhenNoICalAttachment() throws Exception {
-        Mail mail = FakeMail.builder()
-              .mimeMessage(messageWithoutICSAttached)
-              .sender(new MailAddress(FROM))
-              .recipient(new MailAddress(RECIPIENT))
-              .build();
-
-        try (SMTPMessageSender messageSender = SMTPMessageSender.noAuthentication(LOCALHOST_IP, SMTP_PORT, DEFAULT_DOMAIN)) {
-            messageSender.sendMessage(mail)
-                .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
-
-            imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
-                .login(RECIPIENT, PASSWORD)
-                .select(IMAPMessageReader.INBOX)
-                .awaitMessage(calmlyAwait.atMost(ONE_MINUTE));
-        }
+        messageSender.connect(LOCALHOST_IP, SMTP_PORT)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(messageWithoutICSAttached)
+                .sender(FROM)
+                .recipient(RECIPIENT))
+            .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
+
+        imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
+            .login(RECIPIENT, PASSWORD)
+            .select(IMAPMessageReader.INBOX)
+            .awaitMessage(calmlyAwait.atMost(ONE_MINUTE));
 
         assertThat(amqpRule.readContent()).isEmpty();
     }
 
     @Test
     public void calendarAttachmentShouldBePublishedInMQWhenMatchingWorkflowConfiguration() throws Exception {
-        Mail mail = FakeMail.builder()
-              .mimeMessage(messageWithICSAttached)
-              .sender(new MailAddress(FROM))
-              .recipient(new MailAddress(RECIPIENT))
-              .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(messageWithICSAttached)
+                .sender(FROM)
+                .recipient(RECIPIENT))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -624,14 +615,11 @@ public class ICSAttachmentWorkflowTest {
 
     @Test
     public void headersShouldNotBeAddedInMailWhenNoICalAttachment() throws Exception {
-        Mail mail = FakeMail.builder()
-              .mimeMessage(messageWithoutICSAttached)
-              .sender(new MailAddress(FROM))
-              .recipient(new MailAddress(RECIPIENT))
-              .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(messageWithoutICSAttached)
+                .sender(FROM)
+                .recipient(RECIPIENT))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -649,14 +637,11 @@ public class ICSAttachmentWorkflowTest {
 
     @Test
     public void headersShouldBeAddedInMailWhenOneICalAttachment() throws Exception {
-        Mail mail = FakeMail.builder()
-              .mimeMessage(messageWithICSAttached)
-              .sender(new MailAddress(FROM))
-              .recipient(new MailAddress(RECIPIENT))
-              .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(messageWithICSAttached)
+                .sender(FROM)
+                .recipient(RECIPIENT))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -673,14 +658,11 @@ public class ICSAttachmentWorkflowTest {
 
     @Test
     public void headersShouldBeAddedInMailWhenOneBase64ICalAttachment() throws Exception {
-        Mail mail = FakeMail.builder()
-            .mimeMessage(messageWithICSBase64Attached)
-            .sender(new MailAddress(FROM))
-            .recipient(new MailAddress(RECIPIENT))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(messageWithICSBase64Attached)
+                .sender(FROM)
+                .recipient(RECIPIENT))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -697,14 +679,11 @@ public class ICSAttachmentWorkflowTest {
 
     @Test
     public void base64CalendarAttachmentShouldBePublishedInMQWhenMatchingWorkflowConfiguration() throws Exception {
-        Mail mail = FakeMail.builder()
-            .mimeMessage(messageWithICSBase64Attached)
-            .sender(new MailAddress(FROM))
-            .recipient(new MailAddress(RECIPIENT))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(messageWithICSBase64Attached)
+                .sender(FROM)
+                .recipient(RECIPIENT))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -726,14 +705,11 @@ public class ICSAttachmentWorkflowTest {
 
     @Test
     public void yahooBase64CalendarAttachmentShouldBePublishedInMQWhenMatchingWorkflowConfiguration() throws Exception {
-        Mail mail = FakeMail.builder()
-            .mimeMessage(yahooInvitationMessage)
-            .sender(new MailAddress(FROM))
-            .recipient(new MailAddress(RECIPIENT))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(yahooInvitationMessage)
+                .sender(FROM)
+                .recipient(RECIPIENT))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -756,14 +732,11 @@ public class ICSAttachmentWorkflowTest {
 
     @Test
     public void headersShouldBeFilledOnlyWithOneICalAttachmentWhenMailHasSeveral() throws Exception {
-        Mail mail = FakeMail.builder()
-              .mimeMessage(messageWithThreeICSAttached)
-              .sender(new MailAddress(FROM))
-              .recipient(new MailAddress(RECIPIENT))
-              .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(messageWithThreeICSAttached)
+                .sender(FROM)
+                .recipient(RECIPIENT))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -780,14 +753,11 @@ public class ICSAttachmentWorkflowTest {
 
     @Test
     public void pipelineShouldSendSeveralJSONOverRabbitMQWhenSeveralAttachments() throws Exception {
-        Mail mail = FakeMail.builder()
-            .mimeMessage(messageWithThreeICSAttached)
-            .sender(new MailAddress(FROM))
-            .recipient(new MailAddress(RECIPIENT))
-            .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(messageWithThreeICSAttached)
+                .sender(FROM)
+                .recipient(RECIPIENT))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)
@@ -821,14 +791,12 @@ public class ICSAttachmentWorkflowTest {
     @Test
     public void mailShouldNotContainCalendarContentInTextBodyButAttachment() throws Exception {
         MimeMessage calendarMessage = MimeMessageBuilder.mimeMessageFromStream(ClassLoader.getSystemResourceAsStream("eml/calendar.eml"));
-        Mail mail = FakeMail.builder()
-            .mimeMessage(calendarMessage)
-            .sender(new MailAddress(FROM))
-            .recipient(new MailAddress(RECIPIENT))
-            .build();
 
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(calendarMessage)
+                .sender(FROM)
+                .recipient(RECIPIENT))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
index c79d02a..b902e9f 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
@@ -31,7 +31,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import javax.mail.internet.MimeMessage;
 
 import org.apache.james.MemoryJamesServerMain;
-import org.apache.james.core.MailAddress;
 import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.CommonProcessors;
@@ -45,7 +44,6 @@ import org.apache.james.transport.matchers.RecipientIsLocal;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.IMAPMessageReader;
 import org.apache.james.utils.SMTPMessageSender;
-import org.apache.mailet.Mail;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.MimeMessageBuilder;
 import org.junit.After;
@@ -132,14 +130,11 @@ public class StripAttachmentTest {
             .setSubject("test")
             .build();
 
-        Mail mail = FakeMail.builder()
-              .mimeMessage(message)
-              .sender(new MailAddress(FROM))
-              .recipient(new MailAddress(RECIPIENT))
-              .build();
-
         messageSender.connect(LOCALHOST_IP, SMTP_PORT)
-            .sendMessage(mail)
+            .sendMessage(FakeMail.builder()
+                .mimeMessage(message)
+                .sender(FROM)
+                .recipient(RECIPIENT))
             .awaitSent(calmlyAwait.atMost(ONE_MINUTE));
 
         imapMessageReader.connect(LOCALHOST_IP, IMAP_PORT)

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
index b46f490..b440830 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
@@ -34,10 +34,10 @@ import javax.mail.MessagingException;
 import javax.mail.Session;
 import javax.mail.internet.MimeMessage;
 
+import org.apache.james.core.MailAddress;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.transport.mailets.redirect.SpecialAddress;
 import org.apache.mailet.Mail;
-import org.apache.james.core.MailAddress;
 import org.apache.mailet.base.DateFormats;
 import org.apache.mailet.base.MailAddressFixture;
 import org.apache.mailet.base.RFC2822Headers;
@@ -128,7 +128,7 @@ public class DSNBounceTest {
                 .sender(senderMailAddress)
                 .mimeMessage(mimeMessage)
                 .name(MAILET_NAME)
-                .recipient(new MailAddress("recipient@domain.com"))
+                .recipient("recipient@domain.com")
                 .lastUpdated(DateTime.parse("2016-09-08T14:25:52.000Z").toDate())
                 .build();
 
@@ -160,7 +160,7 @@ public class DSNBounceTest {
                 .attribute("delivery-error", "Delivery error")
                 .mimeMessage(mimeMessage)
                 .name(MAILET_NAME)
-                .recipient(new MailAddress("recipient@domain.com"))
+                .recipient("recipient@domain.com")
                 .lastUpdated(DateTime.parse("2016-09-08T14:25:52.000Z").toDate())
                 .build();
 
@@ -202,7 +202,7 @@ public class DSNBounceTest {
                 .attribute("delivery-error", "Delivery error")
                 .mimeMessage(mimeMessage)
                 .name(MAILET_NAME)
-                .recipient(new MailAddress("recipient@domain.com"))
+                .recipient("recipient@domain.com")
                 .lastUpdated(DateTime.parse("2016-09-08T14:25:52.000Z").toDate())
                 .build();
 
@@ -242,7 +242,7 @@ public class DSNBounceTest {
                 .attribute("delivery-error", "Delivery error")
                 .mimeMessage(mimeMessage)
                 .name(MAILET_NAME)
-                .recipient(new MailAddress("recipient@domain.com"))
+                .recipient("recipient@domain.com")
                 .lastUpdated(DateTime.parse("2016-09-08T14:25:52.000Z").toDate())
                 .remoteAddr("remoteHost")
                 .build();
@@ -281,7 +281,7 @@ public class DSNBounceTest {
                 .attribute("delivery-error", "Delivery error")
                 .mimeMessage(mimeMessage)
                 .name(MAILET_NAME)
-                .recipient(new MailAddress("recipient@domain.com"))
+                .recipient("recipient@domain.com")
                 .lastUpdated(DateTime.parse("2016-09-08T14:25:52.000Z").toDate())
                 .remoteAddr("remoteHost")
                 .build();
@@ -305,7 +305,7 @@ public class DSNBounceTest {
                 .attribute("delivery-error", "Delivery error")
                 .mimeMessage(mimeMessage)
                 .name(MAILET_NAME)
-                .recipient(new MailAddress("recipient@domain.com"))
+                .recipient("recipient@domain.com")
                 .lastUpdated(DateTime.parse("2016-09-08T14:25:52.000Z").toDate())
                 .remoteAddr("remoteHost")
                 .build();
@@ -330,7 +330,7 @@ public class DSNBounceTest {
                 .attribute("delivery-error", "Delivery error")
                 .mimeMessage(mimeMessage)
                 .name(MAILET_NAME)
-                .recipient(new MailAddress("recipient@domain.com"))
+                .recipient("recipient@domain.com")
                 .lastUpdated(DateTime.parse("2016-09-08T14:25:52.000Z").toDate())
                 .remoteAddr("remoteHost")
                 .build();
@@ -356,7 +356,7 @@ public class DSNBounceTest {
                 .sender(senderMailAddress)
                 .mimeMessage(mimeMessage)
                 .name(MAILET_NAME)
-                .recipient(new MailAddress("recipient@domain.com"))
+                .recipient("recipient@domain.com")
                 .lastUpdated(DateTime.parse("2016-09-08T14:25:52.000Z").toDate())
                 .build();
 
@@ -388,7 +388,7 @@ public class DSNBounceTest {
                 .sender(senderMailAddress)
                 .mimeMessage(mimeMessage)
                 .name(MAILET_NAME)
-                .recipient(new MailAddress("recipient@domain.com"))
+                .recipient("recipient@domain.com")
                 .lastUpdated(DateTime.parse("2016-09-08T14:25:52.000Z").toDate())
                 .build();
 
@@ -422,7 +422,7 @@ public class DSNBounceTest {
                 .sender(senderMailAddress)
                 .mimeMessage(mimeMessage)
                 .name(MAILET_NAME)
-                .recipient(new MailAddress("recipient@domain.com"))
+                .recipient("recipient@domain.com")
                 .lastUpdated(DateTime.parse("2016-09-08T14:25:52.000Z").toDate())
                 .build();
 
@@ -456,7 +456,7 @@ public class DSNBounceTest {
                 .sender(senderMailAddress)
                 .mimeMessage(mimeMessage)
                 .name(MAILET_NAME)
-                .recipient(new MailAddress("recipient@domain.com"))
+                .recipient("recipient@domain.com")
                 .lastUpdated(DateTime.parse("2016-09-08T14:25:52.000Z").toDate())
                 .build();
 
@@ -488,7 +488,7 @@ public class DSNBounceTest {
                 .sender(senderMailAddress)
                 .mimeMessage(mimeMessage)
                 .name(MAILET_NAME)
-                .recipient(new MailAddress("recipient@domain.com"))
+                .recipient("recipient@domain.com")
                 .lastUpdated(DateTime.parse("2016-09-08T14:25:52.000Z").toDate())
                 .build();
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java
index dde9d3f..eb0e66f 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java
@@ -137,7 +137,7 @@ public class LocalDeliveryTest {
                             .filename("file.txt")
                             .addHeader("Content-Type", "application/sieve; charset=UTF-8")))
                 .state(Mail.DEFAULT)
-                .recipient(new MailAddress("receiver@domain.com"))
+                .recipient("receiver@domain.com")
                 .build();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
index 8ead6a7..a733c9e 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
@@ -271,8 +271,8 @@ public class SieveIntegrationTest {
             .mimeMessage(MimeMessageBuilder.mimeMessageFromStream(
                 ClassLoader.getSystemResourceAsStream("eml/gmail.eml")))
             .state(Mail.DEFAULT)
-            .recipient(new MailAddress(RECEIVER_DOMAIN_COM))
-            .sender(new MailAddress("sender@any.com"))
+            .recipient(RECEIVER_DOMAIN_COM)
+            .sender("sender@any.com")
             .build();
         testee.service(mail);
 
@@ -426,7 +426,7 @@ public class SieveIntegrationTest {
 
         assertThat(mail.getRecipients()).isEmpty();
         FakeMailContext.SentMail expectedSentMail = FakeMailContext.sentMailBuilder()
-            .sender(new MailAddress("sender@any.com"))
+            .sender("sender@any.com")
             .recipient(new MailAddress("redirect@apache.org"))
             .fromMailet()
             .build();
@@ -793,7 +793,7 @@ public class SieveIntegrationTest {
 
         // Notification of script interpretation failure
         assertThat(fakeMailContext.getSentMails()).containsExactly(FakeMailContext.sentMailBuilder()
-            .recipient(new MailAddress(RECEIVER_DOMAIN_COM))
+            .recipient(RECEIVER_DOMAIN_COM)
             .sender(new MailAddress(RECEIVER_DOMAIN_COM))
             .fromMailet()
             .build());
@@ -963,8 +963,8 @@ public class SieveIntegrationTest {
                             .filename("file.txt")
                             .disposition(MimeBodyPart.ATTACHMENT)))
             .state(Mail.DEFAULT)
-            .recipient(new MailAddress(RECEIVER_DOMAIN_COM))
-            .sender(new MailAddress("sender@any.com"))
+            .recipient(RECEIVER_DOMAIN_COM)
+            .sender("sender@any.com")
             .build();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
index 3ee7c81..0273ddf 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
@@ -199,7 +199,7 @@ public class ToRecipientFolderTest {
                         .filename("file.txt")
                         .addHeader("Content-Type", "application/sieve; charset=UTF-8")))
             .state(Mail.DEFAULT)
-            .recipient(new MailAddress("receiver@domain.com"))
+            .recipient("receiver@domain.com")
             .build();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java
index c4afffa..2dcb91a 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java
@@ -476,8 +476,8 @@ public class ManageSieveMailetTestCase {
     private Mail createUnauthenticatedMail(MimeMessage message) throws Exception {
         return FakeMail.builder()
                 .mimeMessage(message)
-                .sender(new MailAddress(USER))
-                .recipient(new MailAddress(SIEVE_LOCALHOST))
+                .sender(USER)
+                .recipient(SIEVE_LOCALHOST)
                 .build();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java
index e4e2c58..10c7963 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java
@@ -28,10 +28,10 @@ import java.util.Collection;
 
 import javax.mail.MessagingException;
 
+import org.apache.james.core.MailAddress;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.mock.MockDNSService;
 import org.apache.mailet.Mail;
-import org.apache.james.core.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Test;
@@ -59,7 +59,7 @@ public class InSpammerBlacklistTest {
     private Mail createMail(String remoteAddr) throws MessagingException {
         return FakeMail.builder()
                 .remoteAddr(remoteAddr)
-                .recipient(new MailAddress("test@email"))
+                .recipient("test@email")
                 .build();
 
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
index 504593c..b2e3bfd 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
@@ -56,7 +56,6 @@ import javax.mail.internet.MimeMessage;
 import org.apache.commons.io.IOUtils;
 import org.apache.http.client.utils.URIBuilder;
 import org.apache.james.GuiceJamesServer;
-import org.apache.james.core.MailAddress;
 import org.apache.james.jmap.DefaultMailboxes;
 import org.apache.james.jmap.HttpJmapAuthentication;
 import org.apache.james.jmap.api.access.AccessToken;
@@ -4917,8 +4916,8 @@ public abstract class SetMessagesMethodTest {
 
         Mail mail = FakeMail.builder()
             .mimeMessage(calendarMessage)
-            .sender(new MailAddress(fromAddress))
-            .recipient(new MailAddress(fromAddress))
+            .sender(fromAddress)
+            .recipient(fromAddress)
             .build();
         try (SMTPMessageSender messageSender = SMTPMessageSender.noAuthentication(LOCALHOST_IP, SMTP_PORT, USERS_DOMAIN);) {
             messageSender.sendMessage(mail);

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/protocols/jmap/src/test/java/org/apache/james/jmap/mailet/VacationMailetTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/mailet/VacationMailetTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/mailet/VacationMailetTest.java
index 6890acf..ee978fa 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/mailet/VacationMailetTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/mailet/VacationMailetTest.java
@@ -33,6 +33,7 @@ import java.util.concurrent.CompletableFuture;
 
 import javax.mail.MessagingException;
 
+import org.apache.james.core.MailAddress;
 import org.apache.james.jmap.api.vacation.AccountId;
 import org.apache.james.jmap.api.vacation.NotificationRegistry;
 import org.apache.james.jmap.api.vacation.RecipientId;
@@ -40,7 +41,6 @@ import org.apache.james.jmap.api.vacation.Vacation;
 import org.apache.james.jmap.api.vacation.VacationRepository;
 import org.apache.james.jmap.utils.MimeMessageBodyGenerator;
 import org.apache.james.util.date.ZonedDateTimeProvider;
-import org.apache.james.core.MailAddress;
 import org.apache.mailet.MailetContext;
 import org.apache.mailet.base.AutomaticallySentMailDetector;
 import org.apache.mailet.base.test.FakeMail;
@@ -190,7 +190,7 @@ public class VacationMailetTest {
 
         FakeMail mail = FakeMail.builder()
             .fileName("spamMail.eml")
-            .recipients(ImmutableList.of(originalRecipient, secondRecipient))
+            .recipients(originalRecipient, secondRecipient)
             .sender(originalSender)
             .build();
         when(vacationRepository.retrieveVacation(AccountId.fromString(USERNAME)))

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/testing/pom.xml
----------------------------------------------------------------------
diff --git a/server/testing/pom.xml b/server/testing/pom.xml
index 988bb6f..1a1b9fc 100644
--- a/server/testing/pom.xml
+++ b/server/testing/pom.xml
@@ -36,6 +36,11 @@
             <artifactId>apache-mailet-api</artifactId>
         </dependency>
         <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>apache-mailet-base</artifactId>
+            <type>test-jar</type>
+        </dependency>
+        <dependency>
             <groupId>com.jayway.awaitility</groupId>
             <artifactId>awaitility</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/ca7051aa/server/testing/src/main/java/org/apache/james/utils/SMTPMessageSender.java
----------------------------------------------------------------------
diff --git a/server/testing/src/main/java/org/apache/james/utils/SMTPMessageSender.java b/server/testing/src/main/java/org/apache/james/utils/SMTPMessageSender.java
index f719c3e..9370ccd 100644
--- a/server/testing/src/main/java/org/apache/james/utils/SMTPMessageSender.java
+++ b/server/testing/src/main/java/org/apache/james/utils/SMTPMessageSender.java
@@ -33,6 +33,7 @@ import javax.mail.MessagingException;
 import org.apache.commons.net.smtp.AuthenticatingSMTPClient;
 import org.apache.james.core.MailAddress;
 import org.apache.mailet.Mail;
+import org.apache.mailet.base.test.FakeMail;
 import org.junit.rules.ExternalResource;
 
 import com.github.fge.lambdas.Throwing;
@@ -148,6 +149,10 @@ public class SMTPMessageSender extends ExternalResource implements Closeable {
         return this;
     }
 
+    public SMTPMessageSender sendMessage(FakeMail.Builder mail) throws MessagingException {
+        return sendMessage(mail.build());
+    }
+
     private String asString(Message message) throws IOException, MessagingException {
         ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
         message.writeTo(outputStream);


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message