james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [07/44] james-project git commit: JAMES-2267 Improve MimeMessageBuilder fluency: implicit build calling
Date Fri, 05 Jan 2018 02:56:26 GMT
JAMES-2267 Improve MimeMessageBuilder fluency: implicit build calling


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

Branch: refs/heads/improve-mailet-testing-experience-v1
Commit: 0df7c31b1a7a1b0b2c740f4f62d0ce77f5b15a0a
Parents: 7d15ef0
Author: benwa <btellier@linagora.com>
Authored: Tue Dec 19 10:12:48 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Fri Jan 5 09:13:50 2018 +0700

----------------------------------------------------------------------
 .../AutomaticallySentMailDetectorImplTest.java  |   6 +-
 .../org/apache/mailet/base/test/FakeMail.java   |  14 +-
 .../mailet/base/test/MimeMessageBuilder.java    |  29 +++++
 .../mailets/ICALToJsonAttributeTest.java        |  11 +-
 .../transport/mailets/ContactExtractorTest.java |  40 +++---
 .../MailAttributesListToMimeHeadersTest.java    |   7 +-
 .../mailets/RemoveMimeHeaderByPrefixTest.java   |  27 ++--
 .../transport/mailets/RemoveMimeHeaderTest.java |  27 ++--
 .../transport/mailets/StripAttachmentTest.java  | 127 ++++++-------------
 .../mailets/UseHeaderRecipientsTest.java        |  26 ++--
 .../matchers/HasHeaderWithPrefixTest.java       |  12 +-
 .../transport/matchers/HasMimeTypeTest.java     |  35 ++---
 .../transport/matchers/TooManyLinesTest.java    |  11 +-
 .../james/mailets/BounceIntegrationTest.java    |  17 +--
 .../GatewayRemoteDeliveryIntegrationTest.java   |  40 ++----
 .../mailets/NetworkMatcherIntegrationTest.java  |  37 ++----
 .../james/mailets/SmtpAuthIntegrationTest.java  |  15 +--
 .../mailets/configuration/CommonProcessors.java |  99 +++++----------
 .../mailets/configuration/MailetContainer.java  |   5 +
 .../configuration/ProcessorConfiguration.java   |   5 +
 .../crypto/SMIMEDecryptIntegrationTest.java     |  13 +-
 .../crypto/SMIMESignIntegrationTest.java        |  28 ++--
 .../mailets/AmqpForwardAttachmentTest.java      |  13 +-
 .../transport/mailets/ContactExtractorTest.java |   7 +-
 .../mailets/ICSAttachmentWorkflowTest.java      |  24 ++--
 .../transport/mailets/StripAttachmentTest.java  |   9 +-
 .../mailets/delivery/LocalDeliveryTest.java     |   4 +-
 .../mailets/delivery/MailDispatcherTest.java    |  12 +-
 .../mailets/delivery/MailboxAppenderTest.java   |   6 +-
 .../mailets/delivery/SieveIntegrationTest.java  |   4 +-
 .../mailets/delivery/SimpleMailStoreTest.java   |   5 +-
 .../mailets/delivery/ToRecipientFolderTest.java |   4 +-
 .../managesieve/ManageSieveMailetTestCase.java  |   5 +-
 33 files changed, 277 insertions(+), 447 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/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 e0f38f9..c99ff14 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
@@ -292,13 +292,11 @@ public class AutomaticallySentMailDetectorImplTest {
     public void isMdnSentAutomaticallyShouldNotThrowOnBodyPartsWithManyLines() throws Exception {
         int mime4jDefaultMaxHeaderCount = 1000;
         int headerCount = mime4jDefaultMaxHeaderCount + 10;
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .addHeaders()
             .setMultipartWithBodyParts(MimeMessageBuilder.bodyPartBuilder()
                 .addHeaders(Collections.nCopies(headerCount, new MimeMessageBuilder.Header("name", "value")))
-                .data("The body part have 1010 headers, which overpass MIME4J default limits")
-                .build())
-            .build();
+                .data("The body part have 1010 headers, which overpass MIME4J default limits"));
 
         FakeMail fakeMail = FakeMail.builder()
             .sender(MailAddressFixture.ANY_AT_JAMES)

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/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 8a4bcde..beee826 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
@@ -30,13 +30,14 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Properties;
+
 import javax.mail.MessagingException;
 import javax.mail.Session;
 import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeMessage;
 
-import org.apache.mailet.Mail;
 import org.apache.james.core.MailAddress;
+import org.apache.mailet.Mail;
 import org.apache.mailet.PerRecipientHeaders;
 import org.apache.mailet.PerRecipientHeaders.Header;
 
@@ -50,6 +51,12 @@ import com.google.common.collect.Maps;
 
 public class FakeMail implements Mail {
 
+    public static FakeMail fromMessage(MimeMessageBuilder message) throws MessagingException {
+        return FakeMail.builder()
+            .mimeMessage(message)
+            .build();
+    }
+
     public static FakeMail fromMime(String text, String javaEncodingCharset, String javamailDefaultEncodingCharset) throws MessagingException, UnsupportedEncodingException {
         Properties javamailProperties = new Properties();
         javamailProperties.setProperty("mail.mime.charset", javamailDefaultEncodingCharset);
@@ -126,6 +133,11 @@ public class FakeMail implements Mail {
             return this;
         }
 
+        public Builder mimeMessage(MimeMessageBuilder mimeMessage) throws MessagingException {
+            this.mimeMessage = Optional.of(mimeMessage.build());
+            return this;
+        }
+
         public Builder recipients(List<MailAddress> recipients) {
             this.recipients.addAll(recipients);
             return this;

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/mailet/base/src/test/java/org/apache/mailet/base/test/MimeMessageBuilder.java
----------------------------------------------------------------------
diff --git a/mailet/base/src/test/java/org/apache/mailet/base/test/MimeMessageBuilder.java b/mailet/base/src/test/java/org/apache/mailet/base/test/MimeMessageBuilder.java
index 4c59513..f5a5caf 100644
--- a/mailet/base/src/test/java/org/apache/mailet/base/test/MimeMessageBuilder.java
+++ b/mailet/base/src/test/java/org/apache/mailet/base/test/MimeMessageBuilder.java
@@ -45,6 +45,7 @@ import javax.mail.util.ByteArrayDataSource;
 
 import org.apache.commons.io.IOUtils;
 
+import com.github.fge.lambdas.Throwing;
 import com.github.steveash.guavate.Guavate;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Throwables;
@@ -70,11 +71,23 @@ public class MimeMessageBuilder {
             return this;
         }
 
+        public MultipartBuilder addBody(BodyPartBuilder bodyPart) throws IOException, MessagingException {
+            this.bodyParts.add(bodyPart.build());
+            return this;
+        }
+
         public MultipartBuilder addBodies(BodyPart... bodyParts) {
             this.bodyParts.addAll(Arrays.asList(bodyParts));
             return this;
         }
 
+        public MultipartBuilder addBodies(BodyPartBuilder... bodyParts) {
+            this.bodyParts.addAll(Arrays.stream(bodyParts)
+                .map(Throwing.function(BodyPartBuilder::build).sneakyThrow())
+                .collect(Guavate.toImmutableList()));
+            return this;
+        }
+
         public MimeMultipart build() throws MessagingException {
             MimeMultipart multipart = new MimeMultipart();
             List<BodyPart> bodyParts = this.bodyParts.build();
@@ -311,6 +324,11 @@ public class MimeMessageBuilder {
         return this;
     }
 
+    public MimeMessageBuilder setContent(MultipartBuilder mimeMultipart) throws MessagingException {
+        this.content = Optional.of(mimeMultipart.build());
+        return this;
+    }
+
     public MimeMessageBuilder setMultipartWithBodyParts(BodyPart... bobyParts) throws MessagingException {
         this.content = Optional.of(MimeMessageBuilder.multipartBuilder()
             .addBodies(bobyParts)
@@ -318,6 +336,13 @@ public class MimeMessageBuilder {
         return this;
     }
 
+    public MimeMessageBuilder setMultipartWithBodyParts(BodyPartBuilder... bobyParts) throws MessagingException {
+        this.content = Optional.of(MimeMessageBuilder.multipartBuilder()
+            .addBodies(bobyParts)
+            .build());
+        return this;
+    }
+
     public MimeMessageBuilder setMultipartWithSubMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
         return setMultipartWithBodyParts(
             new MimeBodyPart(
@@ -325,6 +350,10 @@ public class MimeMessageBuilder {
                 IOUtils.toByteArray(mimeMessage.getInputStream())));
     }
 
+    public MimeMessageBuilder setMultipartWithSubMessage(MimeMessageBuilder mimeMessage) throws MessagingException, IOException {
+        return setMultipartWithSubMessage(mimeMessage.build());
+    }
+
     public MimeMessageBuilder addHeader(String name, String value) {
         this.headers.add(new Header(name, value));
         return this;

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/mailet/icalendar/src/test/java/org/apache/james/transport/mailets/ICALToJsonAttributeTest.java
----------------------------------------------------------------------
diff --git a/mailet/icalendar/src/test/java/org/apache/james/transport/mailets/ICALToJsonAttributeTest.java b/mailet/icalendar/src/test/java/org/apache/james/transport/mailets/ICALToJsonAttributeTest.java
index f656c9a..4397c68 100644
--- a/mailet/icalendar/src/test/java/org/apache/james/transport/mailets/ICALToJsonAttributeTest.java
+++ b/mailet/icalendar/src/test/java/org/apache/james/transport/mailets/ICALToJsonAttributeTest.java
@@ -31,8 +31,8 @@ import java.util.stream.Collectors;
 
 import javax.mail.MessagingException;
 
-import org.apache.mailet.Mail;
 import org.apache.james.core.MailAddress;
+import org.apache.mailet.Mail;
 import org.apache.mailet.base.MailAddressFixture;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
@@ -444,8 +444,7 @@ public class ICALToJsonAttributeTest {
             .sender(SENDER)
             .recipient(recipient)
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .addFrom(from)
-                .build())
+                .addFrom(from))
             .attribute(ICALToJsonAttribute.DEFAULT_SOURCE_ATTRIBUTE_NAME, icals)
             .attribute(ICALToJsonAttribute.DEFAULT_RAW_SOURCE_ATTRIBUTE_NAME, rawIcals)
             .build();
@@ -479,8 +478,7 @@ public class ICALToJsonAttributeTest {
         Mail mail = FakeMail.builder()
             .sender(SENDER)
             .recipient(recipient)
-            .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .build())
+            .mimeMessage(MimeMessageBuilder.defaultMimeMessage())
             .attribute(ICALToJsonAttribute.DEFAULT_SOURCE_ATTRIBUTE_NAME, icals)
             .attribute(ICALToJsonAttribute.DEFAULT_RAW_SOURCE_ATTRIBUTE_NAME, rawIcals)
             .build();
@@ -515,8 +513,7 @@ public class ICALToJsonAttributeTest {
         Mail mail = FakeMail.builder()
             .recipient(recipient)
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .addFrom(from)
-                .build())
+                .addFrom(from))
             .attribute(ICALToJsonAttribute.DEFAULT_SOURCE_ATTRIBUTE_NAME, icals)
             .attribute(ICALToJsonAttribute.DEFAULT_RAW_SOURCE_ATTRIBUTE_NAME, rawIcals)
             .build();

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/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 7546025..99b04f4 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
@@ -103,12 +103,11 @@ public class ContactExtractorTest {
 
     @Test
     public void serviceShouldAddTheAttribute() throws Exception {
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
                 .setSender(SENDER)
                 .addToRecipient(TO)
                 .setSubject("Contact collection Rocks")
-                .setText("This is my email")
-                .build();
+                .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
             .sender(new MailAddress(SENDER))
             .recipient(new MailAddress(TO))
@@ -123,12 +122,11 @@ public class ContactExtractorTest {
 
     @Test
     public void serviceShouldPreserveRecipientsEmailAddress() throws Exception {
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setSender(SENDER)
             .addToRecipient("To <" + TO + ">")
             .setSubject("Contact collection Rocks")
-            .setText("This is my email")
-            .build();
+            .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
             .sender(new MailAddress(SENDER))
             .recipient(new MailAddress(TO))
@@ -143,12 +141,11 @@ public class ContactExtractorTest {
 
     @Test
     public void serviceShouldUnscrambleRecipients() throws Exception {
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setSender(SENDER)
             .addToRecipient("=?ISO-8859-1?Q?Beno=EEt_TELLIER?= <tellier@linagora.com>")
             .setSubject("Contact collection Rocks")
-            .setText("This is my email")
-            .build();
+            .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
             .sender(new MailAddress(SENDER))
             .recipient(new MailAddress(TO))
@@ -223,12 +220,11 @@ public class ContactExtractorTest {
 
     @Test
     public void serviceShouldNotOverwriteSenderWhenDifferentFromField() throws Exception {
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .addFrom("other@sender.org")
             .addToRecipient("To <" + TO + ">")
             .setSubject("Contact collection Rocks")
-            .setText("This is my email")
-            .build();
+            .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
             .sender(new MailAddress(SENDER))
             .recipient(new MailAddress(TO))
@@ -243,12 +239,11 @@ public class ContactExtractorTest {
 
     @Test
     public void serviceShouldNotOverwriteSenderWhenDifferentSenderField() throws Exception {
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setSender("other@sender.org")
             .addToRecipient("To <" + TO + ">")
             .setSubject("Contact collection Rocks")
-            .setText("This is my email")
-            .build();
+            .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
             .sender(new MailAddress(SENDER))
             .recipient(new MailAddress(TO))
@@ -263,11 +258,10 @@ public class ContactExtractorTest {
 
     @Test
     public void serviceShouldSkipMessagesWithoutSenderEnvelope() throws Exception {
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .addToRecipient("To <" + TO + ">")
             .setSubject("Contact collection Rocks")
-            .setText("This is my email")
-            .build();
+            .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
             .recipient(new MailAddress(TO))
             .build();
@@ -280,11 +274,10 @@ public class ContactExtractorTest {
 
     @Test
     public void serviceShouldNotAddTheAttributeWhenNoRecipient() throws Exception {
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
                 .setSender(SENDER)
                 .setSubject("Contact collection Rocks")
-                .setText("This is my email")
-                .build();
+                .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
             .sender(new MailAddress(SENDER))
             .build();
@@ -297,11 +290,10 @@ public class ContactExtractorTest {
 
     @Test
     public void extractContactsShouldNotThrowWhenNoRecipient() throws Exception {
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
                 .setSender(SENDER)
                 .setSubject("Contact collection Rocks")
-                .setText("This is my email")
-                .build();
+                .setText("This is my email");
         FakeMail mail = FakeMail.builder().mimeMessage(message)
             .sender(new MailAddress(SENDER))
             .build();

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeadersTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeadersTest.java b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeadersTest.java
index 2b21058..7479385 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeadersTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeadersTest.java
@@ -190,8 +190,7 @@ public class MailAttributesListToMimeHeadersTest {
         String firstValue = "first value";
         FakeMail mail = FakeMail.builder()
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .addHeader(HEADER_NAME1, firstValue)
-                .build())
+                .addHeader(HEADER_NAME1, firstValue))
             .attribute(MAIL_ATTRIBUTE_NAME1, MAIL_ATTRIBUTE_VALUE1)
             .build();
 
@@ -212,7 +211,7 @@ public class MailAttributesListToMimeHeadersTest {
         mailet.init(mailetConfig);
 
         FakeMail mail = FakeMail.builder()
-            .mimeMessage(MimeMessageBuilder.mimeMessageBuilder().build())
+            .mimeMessage(MimeMessageBuilder.mimeMessageBuilder())
             .attribute(MAIL_ATTRIBUTE_NAME1, 3L)
             .attribute(MAIL_ATTRIBUTE_NAME2, MAIL_ATTRIBUTE_VALUE2)
             .build();
@@ -235,7 +234,7 @@ public class MailAttributesListToMimeHeadersTest {
 
         String value = "value";
         FakeMail mail = FakeMail.builder()
-            .mimeMessage(MimeMessageBuilder.mimeMessageBuilder().build())
+            .mimeMessage(MimeMessageBuilder.mimeMessageBuilder())
             .attribute(MAIL_ATTRIBUTE_NAME1, ImmutableList.of(3L, value))
             .build();
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderByPrefixTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderByPrefixTest.java b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderByPrefixTest.java
index 2a820da..f6dabe2 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderByPrefixTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderByPrefixTest.java
@@ -22,7 +22,6 @@ package org.apache.james.transport.mailets;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import javax.mail.MessagingException;
-import javax.mail.internet.MimeMessage;
 
 import org.apache.james.transport.mailets.utils.MimeMessageUtils;
 import org.apache.mailet.Mail;
@@ -65,9 +64,8 @@ public class RemoveMimeHeaderByPrefixTest {
                 .build();
         mailet.init(mailetConfig);
 
-        Mail mail = createMail(MimeMessageBuilder.mimeMessageBuilder()
-            .addHeader(HEADER_NAME_PREFIX_1, "true")
-            .build());
+        Mail mail = FakeMail.fromMessage(MimeMessageBuilder.mimeMessageBuilder()
+            .addHeader(HEADER_NAME_PREFIX_1, "true"));
 
         mailet.service(mail);
 
@@ -84,10 +82,9 @@ public class RemoveMimeHeaderByPrefixTest {
             .build();
         mailet.init(mailetConfig);
 
-        Mail mail = createMail(MimeMessageBuilder.mimeMessageBuilder()
+        Mail mail = FakeMail.fromMessage(MimeMessageBuilder.mimeMessageBuilder()
             .addHeader(HEADER_NAME_PREFIX_1, "true")
-            .addHeader(HEADER_NAME_PREFIX_2, "true")
-            .build());
+            .addHeader(HEADER_NAME_PREFIX_2, "true"));
 
         mailet.service(mail);
 
@@ -104,10 +101,9 @@ public class RemoveMimeHeaderByPrefixTest {
             .build();
         mailet.init(mailetConfig);
 
-        Mail mail = createMail(MimeMessageBuilder.mimeMessageBuilder()
+        Mail mail = FakeMail.fromMessage(MimeMessageBuilder.mimeMessageBuilder()
             .addHeader(HEADER_NAME_PREFIX_1, "true")
-            .addHeader(HEADER_NAME_NO_PREFIX, "true")
-            .build());
+            .addHeader(HEADER_NAME_NO_PREFIX, "true"));
 
         mailet.service(mail);
 
@@ -125,10 +121,9 @@ public class RemoveMimeHeaderByPrefixTest {
             .build();
         mailet.init(mailetConfig);
 
-        Mail mail = createMail(MimeMessageBuilder.mimeMessageBuilder()
+        Mail mail = FakeMail.fromMessage(MimeMessageBuilder.mimeMessageBuilder()
             .addHeader(PREFIX, "true")
-            .addHeader(HEADER_NAME_NO_PREFIX, "true")
-            .build());
+            .addHeader(HEADER_NAME_NO_PREFIX, "true"));
 
         mailet.service(mail);
 
@@ -157,10 +152,4 @@ public class RemoveMimeHeaderByPrefixTest {
             .build();
         mailet.init(mailetConfig);
     }
-
-    private Mail createMail(MimeMessage message) throws MessagingException {
-        return FakeMail.builder()
-                .mimeMessage(message)
-                .build();
-    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderTest.java b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderTest.java
index 5482b52..df2fa47 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderTest.java
@@ -26,7 +26,6 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import javax.mail.MessagingException;
-import javax.mail.internet.MimeMessage;
 
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
@@ -66,10 +65,9 @@ public class RemoveMimeHeaderTest {
                 .build();
         mailet.init(mailetConfig);
 
-        Mail mail = createMail(MimeMessageBuilder.mimeMessageBuilder()
+        Mail mail = FakeMail.fromMessage(MimeMessageBuilder.mimeMessageBuilder()
             .addHeader(HEADER1, "true")
-            .addHeader(HEADER2, "true")
-            .build());
+            .addHeader(HEADER2, "true"));
 
         mailet.service(mail);
 
@@ -85,10 +83,9 @@ public class RemoveMimeHeaderTest {
                 .build();
         mailet.init(mailetConfig);
 
-        Mail mail = createMail(MimeMessageBuilder.mimeMessageBuilder()
+        Mail mail = FakeMail.fromMessage(MimeMessageBuilder.mimeMessageBuilder()
             .addHeader(HEADER1, "true")
-            .addHeader(HEADER2, "true")
-            .build());
+            .addHeader(HEADER2, "true"));
 
         mailet.service(mail);
 
@@ -105,10 +102,9 @@ public class RemoveMimeHeaderTest {
                 .build();
         mailet.init(mailetConfig);
 
-        Mail mail = createMail(MimeMessageBuilder.mimeMessageBuilder()
+        Mail mail = FakeMail.fromMessage(MimeMessageBuilder.mimeMessageBuilder()
             .addHeader(HEADER1, "true")
-            .addHeader(HEADER2, "true")
-            .build());
+            .addHeader(HEADER2, "true"));
 
         mailet.service(mail);
 
@@ -124,10 +120,9 @@ public class RemoveMimeHeaderTest {
                 .build();
         mailet.init(mailetConfig);
 
-        Mail mail = createMail(MimeMessageBuilder.mimeMessageBuilder()
+        Mail mail = FakeMail.fromMessage(MimeMessageBuilder.mimeMessageBuilder()
             .addHeader(HEADER1, "true")
-            .addHeader(HEADER2, "true")
-            .build());
+            .addHeader(HEADER2, "true"));
 
         mailet.service(mail);
 
@@ -160,10 +155,4 @@ public class RemoveMimeHeaderTest {
         assertThatThrownBy(() -> mailet.service(mail))
             .isInstanceOf(MessagingException.class);
     }
-
-    private Mail createMail(MimeMessage message) throws MessagingException {
-        return FakeMail.builder()
-                .mimeMessage(message)
-                .build();
-    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/mailet/standard/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java b/mailet/standard/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
index a731a86..adcd0c5 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
@@ -32,15 +32,14 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 
-import javax.mail.BodyPart;
 import javax.mail.MessagingException;
 import javax.mail.Part;
 import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMultipart;
 
-import org.apache.james.transport.mailets.StripAttachment.OutputFileName;
 import org.apache.commons.io.IOUtils;
+import org.apache.james.transport.mailets.StripAttachment.OutputFileName;
 import org.apache.mailet.Mail;
 import org.apache.mailet.Mailet;
 import org.apache.mailet.MailetException;
@@ -101,22 +100,16 @@ public class StripAttachmentTest {
     @Test
     public void serviceShouldNotModifyMailWhenNotMultipart() throws MessagingException, IOException {
         Mailet mailet = initMailet();
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setSubject("test")
-            .setText("simple text")
-            .build();
+            .setText("simple text");
 
-        MimeMessage expectedMessage = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder expectedMessage = MimeMessageBuilder.mimeMessageBuilder()
             .setSubject("test")
-            .setText("simple text")
-            .build();
+            .setText("simple text");
 
-        Mail mail = FakeMail.builder()
-                .mimeMessage(message)
-                .build();
-        Mail expectedMail = FakeMail.builder()
-                .mimeMessage(expectedMessage)
-                .build();
+        Mail mail = FakeMail.fromMessage(message);
+        Mail expectedMail = FakeMail.fromMessage(expectedMessage);
 
         mailet.service(mail);
 
@@ -129,18 +122,14 @@ public class StripAttachmentTest {
         Mailet mailet = initMailet();
 
         String expectedAttachmentContent = EXPECTED_ATTACHMENT_CONTENT;
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setMultipartWithBodyParts(
                 MimeMessageBuilder.bodyPartBuilder()
-                    .data("simple text")
-                    .build(),
+                    .data("simple text"),
                 createAttachmentBodyPart(expectedAttachmentContent, "10.tmp", TEXT_HEADERS),
-                createAttachmentBodyPart("\u0014\u00A3\u00E1\u00E2\u00E4", "temp.zip", TEXT_HEADERS))
-            .build();
+                createAttachmentBodyPart("\u0014\u00A3\u00E1\u00E2\u00E4", "temp.zip", TEXT_HEADERS));
 
-        Mail mail = FakeMail.builder()
-                .mimeMessage(message)
-                .build();
+        Mail mail = FakeMail.fromMessage(message);
 
         mailet.service(mail);
 
@@ -165,20 +154,16 @@ public class StripAttachmentTest {
         mailet.init(mci);
 
         String expectedFileName = "10.ical";
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setMultipartWithBodyParts(
                 MimeMessageBuilder.bodyPartBuilder()
-                    .data("simple text")
-                    .build(),
+                    .data("simple text"),
                 createAttachmentBodyPart("content", expectedFileName, CALENDAR_HEADERS),
                 createAttachmentBodyPart("other content", "11.ical", TEXT_HEADERS),
-                createAttachmentBodyPart("<p>html</p>", "index.html", HTML_HEADERS))
-            .build();
+                createAttachmentBodyPart("<p>html</p>", "index.html", HTML_HEADERS));
 
 
-        Mail mail = FakeMail.builder()
-                .mimeMessage(message)
-                .build();
+        Mail mail = FakeMail.fromMessage(message);
 
         mailet.service(mail);
 
@@ -187,13 +172,12 @@ public class StripAttachmentTest {
         assertThat(removedAttachments).containsOnly(expectedFileName);
     }
 
-    private BodyPart createAttachmentBodyPart(String body, String fileName, MimeMessageBuilder.Header... headers) throws MessagingException, IOException {
+    private MimeMessageBuilder.BodyPartBuilder createAttachmentBodyPart(String body, String fileName, MimeMessageBuilder.Header... headers) throws MessagingException, IOException {
         return MimeMessageBuilder.bodyPartBuilder()
             .data(body)
             .addHeaders(headers)
             .disposition(MimeBodyPart.ATTACHMENT)
-            .filename(fileName)
-            .build();
+            .filename(fileName);
     }
 
     @Test
@@ -209,18 +193,14 @@ public class StripAttachmentTest {
         mailet.init(mci);
 
         String expectedAttachmentContent = EXPECTED_ATTACHMENT_CONTENT;
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setMultipartWithBodyParts(
                 MimeMessageBuilder.bodyPartBuilder()
-                    .data("simple text")
-                    .build(),
+                    .data("simple text"),
                 createAttachmentBodyPart(expectedAttachmentContent, "temp_filname.tmp", TEXT_HEADERS),
-                createAttachmentBodyPart("\u0014\u00A3\u00E1\u00E2\u00E4", "winmail.dat", TEXT_HEADERS))
-            .build();
+                createAttachmentBodyPart("\u0014\u00A3\u00E1\u00E2\u00E4", "winmail.dat", TEXT_HEADERS));
 
-        Mail mail = FakeMail.builder()
-                .mimeMessage(message)
-                .build();
+        Mail mail = FakeMail.fromMessage(message);
 
         mailet.service(mail);
 
@@ -246,19 +226,15 @@ public class StripAttachmentTest {
         Mailet mailet = initMailet();
 
         String expectedAttachmentContent = EXPECTED_ATTACHMENT_CONTENT;
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setMultipartWithBodyParts(
                 MimeMessageBuilder.bodyPartBuilder()
-                    .data("simple text")
-                    .build(),
+                    .data("simple text"),
                 createAttachmentBodyPart(expectedAttachmentContent,
                     "=?iso-8859-15?Q?=E9_++++Pubblicit=E0_=E9_vietata____Milano9052.tmp?=", TEXT_HEADERS),
-                createAttachmentBodyPart("\u0014\u00A3\u00E1\u00E2\u00E4", "temp.zip", TEXT_HEADERS))
-            .build();
+                createAttachmentBodyPart("\u0014\u00A3\u00E1\u00E2\u00E4", "temp.zip", TEXT_HEADERS));
 
-        Mail mail = FakeMail.builder()
-                .mimeMessage(message)
-                .build();
+        Mail mail = FakeMail.fromMessage(message);
 
         mailet.service(mail);
 
@@ -289,18 +265,14 @@ public class StripAttachmentTest {
         mailet.init(mci);
 
         String expectedKey = "10.tmp";
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setMultipartWithBodyParts(
                 MimeMessageBuilder.bodyPartBuilder()
-                    .data("simple text")
-                    .build(),
+                    .data("simple text"),
                 createAttachmentBodyPart(EXPECTED_ATTACHMENT_CONTENT, expectedKey, TEXT_HEADERS),
-                createAttachmentBodyPart("\u0014\u00A3\u00E1\u00E2\u00E4", "temp.zip", TEXT_HEADERS))
-            .build();
+                createAttachmentBodyPart("\u0014\u00A3\u00E1\u00E2\u00E4", "temp.zip", TEXT_HEADERS));
 
-        Mail mail = FakeMail.builder()
-                .mimeMessage(message)
-                .build();
+        Mail mail = FakeMail.fromMessage(message);
 
         mailet.service(mail);
 
@@ -326,17 +298,13 @@ public class StripAttachmentTest {
         mailet.init(mci);
 
         String expectedKey = "invite.tmp";
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setMultipartWithBodyParts(
                 MimeMessageBuilder.bodyPartBuilder()
-                    .data("simple text")
-                    .build(),
-                createAttachmentBodyPart(EXPECTED_ATTACHMENT_CONTENT, "=?US-ASCII?Q?" + expectedKey + "?=", TEXT_HEADERS))
-            .build();
+                    .data("simple text"),
+                createAttachmentBodyPart(EXPECTED_ATTACHMENT_CONTENT, "=?US-ASCII?Q?" + expectedKey + "?=", TEXT_HEADERS));
 
-        Mail mail = FakeMail.builder()
-            .mimeMessage(message)
-            .build();
+        Mail mail = FakeMail.fromMessage(message);
 
         mailet.service(mail);
 
@@ -574,8 +542,7 @@ public class StripAttachmentTest {
 
         MimeMessage mimeMessage = MimeMessageBuilder.mimeMessageBuilder()
             .setMultipartWithBodyParts(MimeMessageBuilder.bodyPartBuilder()
-                .filename("removeMe.tmp")
-                .build())
+                .filename("removeMe.tmp"))
             .build();
         Mail mail = mock(Mail.class);
         //When
@@ -598,8 +565,7 @@ public class StripAttachmentTest {
 
         MimeMessage mimeMessage = MimeMessageBuilder.mimeMessageBuilder()
             .setMultipartWithBodyParts(MimeMessageBuilder.bodyPartBuilder()
-                .filename("removeMe.tmp")
-                .build())
+                .filename("removeMe.tmp"))
             .build();
 
         Mail mail = mock(Mail.class);
@@ -625,11 +591,9 @@ public class StripAttachmentTest {
         MimeMessage mimeMessage = MimeMessageBuilder.mimeMessageBuilder()
             .setMultipartWithBodyParts(
                 MimeMessageBuilder.bodyPartBuilder()
-                    .filename("removeMe.tmp")
-                    .build(),
+                    .filename("removeMe.tmp"),
                 MimeMessageBuilder.bodyPartBuilder()
-                    .filename("removeMe.tmp")
-                    .build())
+                    .filename("removeMe.tmp"))
             .build();
 
         Mail mail = FakeMail.builder().build();
@@ -660,11 +624,9 @@ public class StripAttachmentTest {
         MimeMessage mimeMessage = MimeMessageBuilder.mimeMessageBuilder()
             .setMultipartWithBodyParts(
                 MimeMessageBuilder.bodyPartBuilder()
-                    .filename("removeMe1.tmp")
-                    .build(),
+                    .filename("removeMe1.tmp"),
                 MimeMessageBuilder.bodyPartBuilder()
-                    .filename("removeMe2.tmp")
-                    .build())
+                    .filename("removeMe2.tmp"))
             .build();
         
         Mail mail = FakeMail.builder().build();
@@ -696,9 +658,7 @@ public class StripAttachmentTest {
                 MimeMessageBuilder.mimeMessageBuilder()
                     .setMultipartWithBodyParts(
                         MimeMessageBuilder.bodyPartBuilder()
-                            .filename("removeMe.tmp")
-                            .build())
-                    .build())
+                            .filename("removeMe.tmp")))
             .build();
         Mail mail = mock(Mail.class);
         //When
@@ -724,9 +684,7 @@ public class StripAttachmentTest {
                 MimeMessageBuilder.mimeMessageBuilder()
                     .setMultipartWithBodyParts(
                         MimeMessageBuilder.bodyPartBuilder()
-                            .filename("dontRemoveMe.other")
-                            .build())
-                    .build())
+                            .filename("dontRemoveMe.other")))
             .build();
         Mail mail = mock(Mail.class);
         //When
@@ -749,8 +707,7 @@ public class StripAttachmentTest {
 
         MimeMultipart mimeMultipart = MimeMessageBuilder.multipartBuilder()
             .addBody(MimeMessageBuilder.bodyPartBuilder()
-                .filename("removeMe.tmp")
-                .build())
+                .filename("removeMe.tmp"))
             .build();
         MimeMessage mimeMessage = MimeMessageBuilder.mimeMessageBuilder()
             .setContent(mimeMultipart)

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/mailet/standard/src/test/java/org/apache/james/transport/mailets/UseHeaderRecipientsTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/mailets/UseHeaderRecipientsTest.java b/mailet/standard/src/test/java/org/apache/james/transport/mailets/UseHeaderRecipientsTest.java
index 3d25483..c326de3 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/mailets/UseHeaderRecipientsTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/mailets/UseHeaderRecipientsTest.java
@@ -21,8 +21,8 @@ package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import org.apache.mailet.Mail;
 import org.apache.james.core.MailAddress;
+import org.apache.mailet.Mail;
 import org.apache.mailet.base.MailAddressFixture;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
@@ -63,8 +63,7 @@ public class UseHeaderRecipientsTest {
         FakeMail fakeMail = FakeMail.builder()
             .recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.ANY_AT_JAMES2)
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .addToRecipient(RECIPIENT1, RECIPIENT2)
-                .build())
+                .addToRecipient(RECIPIENT1, RECIPIENT2))
             .build();
 
         testee.service(fakeMail);
@@ -80,8 +79,7 @@ public class UseHeaderRecipientsTest {
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
                 .addToRecipient(RECIPIENT1)
                 .addCcRecipient(RECIPIENT2)
-                .addBccRecipient(RECIPIENT3)
-                .build())
+                .addBccRecipient(RECIPIENT3))
             .build();
 
         testee.service(fakeMail);
@@ -95,8 +93,7 @@ public class UseHeaderRecipientsTest {
 
         FakeMail fakeMail = FakeMail.builder()
             .recipients(MailAddressFixture.ANY_AT_JAMES)
-            .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .build())
+            .mimeMessage(MimeMessageBuilder.defaultMimeMessage())
             .build();
 
         testee.service(fakeMail);
@@ -109,8 +106,7 @@ public class UseHeaderRecipientsTest {
     public void serviceShouldGhostEmail() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
             .recipients(MailAddressFixture.ANY_AT_JAMES)
-            .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .build())
+            .mimeMessage(MimeMessageBuilder.defaultMimeMessage())
             .build();
 
         testee.service(fakeMail);
@@ -126,8 +122,7 @@ public class UseHeaderRecipientsTest {
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
                 .addToRecipient(RECIPIENT1)
                 .addCcRecipient(RECIPIENT2)
-                .addBccRecipient(RECIPIENT3)
-                .build())
+                .addBccRecipient(RECIPIENT3))
             .build();
 
         testee.service(fakeMail);
@@ -146,8 +141,7 @@ public class UseHeaderRecipientsTest {
         FakeMail fakeMail = FakeMail.builder()
             .recipients(mailAddress1)
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .addToRecipient("invalid")
-                .build())
+                .addToRecipient("invalid"))
             .build();
 
         testee.service(fakeMail);
@@ -158,8 +152,7 @@ public class UseHeaderRecipientsTest {
         FakeMail fakeMail = FakeMail.builder()
             .recipients()
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .addToRecipient(RECIPIENT1, RECIPIENT2)
-                .build())
+                .addToRecipient(RECIPIENT1, RECIPIENT2))
             .build();
 
         testee.service(fakeMail);
@@ -173,8 +166,7 @@ public class UseHeaderRecipientsTest {
         FakeMail fakeMail = FakeMail.builder()
             .recipients()
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .addToRecipient("APACHE" + "<" + UseHeaderRecipientsTest.RECIPIENT1 + ">")
-                .build())
+                .addToRecipient("APACHE" + "<" + UseHeaderRecipientsTest.RECIPIENT1 + ">"))
             .build();
 
         testee.service(fakeMail);

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasHeaderWithPrefixTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasHeaderWithPrefixTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasHeaderWithPrefixTest.java
index 90f2978..734e798 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasHeaderWithPrefixTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasHeaderWithPrefixTest.java
@@ -61,8 +61,7 @@ public class HasHeaderWithPrefixTest {
 
         Mail mail = FakeMail.builder()
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .addHeader(HEADER_NAME_PREFIX_1, "true")
-                .build())
+                .addHeader(HEADER_NAME_PREFIX_1, "true"))
             .recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES2)
             .build();
 
@@ -80,8 +79,7 @@ public class HasHeaderWithPrefixTest {
 
         Mail mail = FakeMail.builder()
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .addHeader(PREFIX, "true")
-                .build())
+                .addHeader(PREFIX, "true"))
             .recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES2)
             .build();
 
@@ -99,8 +97,7 @@ public class HasHeaderWithPrefixTest {
 
         Mail mail = FakeMail.builder()
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .addHeader(HEADER_NAME_NO_PREFIX, "true")
-                .build())
+                .addHeader(HEADER_NAME_NO_PREFIX, "true"))
             .recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES2)
             .build();
 
@@ -119,8 +116,7 @@ public class HasHeaderWithPrefixTest {
         Mail mail = FakeMail.builder()
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
                 .addHeader(HEADER_NAME_PREFIX_1, "true")
-                .addHeader(HEADER_NAME_NO_PREFIX, "true")
-                .build())
+                .addHeader(HEADER_NAME_NO_PREFIX, "true"))
             .recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES2)
             .build();
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/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 70a80b2..f6ab324 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,8 +21,6 @@ package org.apache.james.transport.matchers;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import javax.mail.internet.MimeMessage;
-
 import org.apache.james.core.MailAddress;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.test.FakeMail;
@@ -52,23 +50,19 @@ public class HasMimeTypeTest {
                 .condition(MIME_TYPES)
                 .build());
 
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setMultipartWithBodyParts(
                 MimeMessageBuilder.bodyPartBuilder()
                     .data("simple text")
-                    .disposition("text")
-                    .build(),
+                    .disposition("text"),
                 MimeMessageBuilder.bodyPartBuilder()
                     .filename("text_file.txt")
-                    .disposition("attachment")
-                    .build(),
+                    .disposition("attachment"),
                 MimeMessageBuilder.bodyPartBuilder()
                     .type("application/zip")
                     .filename("zip_file.zip")
-                    .disposition("attachment")
-                    .build())
-            .setSubject("test")
-            .build();
+                    .disposition("attachment"))
+            .setSubject("test");
 
         Mail mail = FakeMail.builder()
             .mimeMessage(message)
@@ -86,23 +80,19 @@ public class HasMimeTypeTest {
                 .condition(NON_MATCHING_MIME_TYPES)
                 .build());
 
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setMultipartWithBodyParts(
                 MimeMessageBuilder.bodyPartBuilder()
                     .data("simple text")
-                    .disposition("text")
-                    .build(),
+                    .disposition("text"),
                 MimeMessageBuilder.bodyPartBuilder()
                     .filename("text_file.txt")
-                    .disposition("attachment")
-                    .build(),
+                    .disposition("attachment"),
                 MimeMessageBuilder.bodyPartBuilder()
                     .type("application/zip")
                     .filename("zip_file.zip")
-                    .disposition("attachment")
-                    .build())
-            .setSubject("test")
-            .build();
+                    .disposition("attachment"))
+            .setSubject("test");
 
         Mail mail = FakeMail.builder()
             .mimeMessage(message)
@@ -120,10 +110,9 @@ public class HasMimeTypeTest {
             .condition("text/md, text/html")
             .build());
 
-        MimeMessage message = MimeMessageBuilder.mimeMessageBuilder()
+        MimeMessageBuilder message = MimeMessageBuilder.mimeMessageBuilder()
             .setText("content <b>in</b> <i>HTML</i>", "text/html")
-            .setSubject("test")
-            .build();
+            .setSubject("test");
 
         Mail mail = FakeMail.builder()
             .mimeMessage(message)

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyLinesTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyLinesTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyLinesTest.java
index 691b27d..c190387 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyLinesTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/TooManyLinesTest.java
@@ -117,9 +117,7 @@ public class TooManyLinesTest {
         FakeMail fakeMail = FakeMail.builder()
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
                 .setMultipartWithBodyParts(MimeMessageBuilder.bodyPartBuilder()
-                    .data("content")
-                    .build())
-                .build())
+                    .data("content")))
             .build();
 
         Collection<MailAddress> result = testee.match(fakeMail);
@@ -133,10 +131,9 @@ public class TooManyLinesTest {
 
         FakeMail fakeMail = FakeMail.builder()
             .mimeMessage(MimeMessageBuilder.mimeMessageBuilder()
-                .setMultipartWithBodyParts(MimeMessageBuilder.bodyPartBuilder()
-                    .data("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11")
-                    .build())
-                .build())
+                .setMultipartWithBodyParts(
+                    MimeMessageBuilder.bodyPartBuilder()
+                        .data("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11")))
             .build();
 
         Collection<MailAddress> result = testee.match(fakeMail);

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java
index f8daddb..919fb35 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java
@@ -263,34 +263,29 @@ public class BounceIntegrationTest {
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(RemoveMimeHeader.class)
-                .addProperty("name", "bcc")
-                .build())
+                .addProperty("name", "bcc"))
             .addMailet(MailetConfiguration.builder()
                 .matcher(RecipientIsLocal.class)
-                .mailet(VacationMailet.class)
-                .build())
+                .mailet(VacationMailet.class))
             .addMailet(MailetConfiguration.builder()
                 .matcher(RecipientIs.class)
                 .matcherCondition(BOUNCE_RECEIVER)
-                .mailet(LocalDelivery.class)
-                .build())
+                .mailet(LocalDelivery.class))
             .addMailet(MailetConfiguration.builder()
                 .matcher(RecipientIs.class)
                 .matcherCondition(POSTMASTER)
-                .mailet(LocalDelivery.class)
-                .build())
+                .mailet(LocalDelivery.class))
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(ToProcessor.class)
-                .addProperty("processor", "bounces")
-                .build())
+                .addProperty("processor", "bounces"))
             .build();
     }
 
     public static ProcessorConfiguration bounces(MailetConfiguration.Builder redirectionMailetConfiguration) {
         return ProcessorConfiguration.builder()
             .state("bounces")
-            .addMailet(redirectionMailetConfiguration.build())
+            .addMailet(redirectionMailetConfiguration)
             .build();
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
index abdac8b..9df8289 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
@@ -280,12 +280,10 @@ public class GatewayRemoteDeliveryIntegrationTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(RemoveMimeHeader.class)
-                        .addProperty("name", "bcc")
-                        .build())
+                        .addProperty("name", "bcc"))
                     .addMailet(MailetConfiguration.builder()
                         .matcher(RecipientIsLocal.class)
-                        .mailet(LocalDelivery.class)
-                        .build())
+                        .mailet(LocalDelivery.class))
                     .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(RemoteDelivery.class)
@@ -295,9 +293,7 @@ public class GatewayRemoteDeliveryIntegrationTest {
                         .addProperty("maxDnsProblemRetries", "0")
                         .addProperty("deliveryThreads", "2")
                         .addProperty("sendpartial", "true")
-                        .addProperty("gateway", gatewayProperty)
-                        .build())
-                    .build())
+                        .addProperty("gateway", gatewayProperty)))
                 .addProcessor(CommonProcessors.bounces())
                 .build());
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -376,18 +372,15 @@ public class GatewayRemoteDeliveryIntegrationTest {
             .enableJmx(true)
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
-                .mailet(PostmasterAlias.class)
-                .build())
+                .mailet(PostmasterAlias.class))
             .addMailet(MailetConfiguration.builder()
                 .matcher(RelayLimit.class)
                 .matcherCondition("30")
-                .mailet(Null.class)
-                .build())
+                .mailet(Null.class))
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(ToProcessor.class)
-                .addProperty("processor", "transport")
-                .build())
+                .addProperty("processor", "transport"))
             .build();
     }
 
@@ -398,8 +391,7 @@ public class GatewayRemoteDeliveryIntegrationTest {
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(RemoveMimeHeader.class)
-                .addProperty("name", "bcc")
-                .build())
+                .addProperty("name", "bcc"))
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(RemoteDelivery.class)
@@ -410,8 +402,7 @@ public class GatewayRemoteDeliveryIntegrationTest {
                 .addProperty("deliveryThreads", "2")
                 .addProperty("sendpartial", "true")
                 .addProperty("bounceProcessor", "bounces")
-                .addProperty("gateway", gatewayProperty)
-                .build())
+                .addProperty("gateway", gatewayProperty))
             .build();
     }
 
@@ -422,12 +413,10 @@ public class GatewayRemoteDeliveryIntegrationTest {
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(RemoveMimeHeader.class)
-                .addProperty("name", "bcc")
-                .build())
+                .addProperty("name", "bcc"))
             .addMailet(MailetConfiguration.builder()
                 .matcher(RecipientIsLocal.class)
-                .mailet(LocalDelivery.class)
-                .build())
+                .mailet(LocalDelivery.class))
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(RemoteDelivery.class)
@@ -438,8 +427,7 @@ public class GatewayRemoteDeliveryIntegrationTest {
                 .addProperty("deliveryThreads", "2")
                 .addProperty("sendpartial", "true")
                 .addProperty("bounceProcessor", "bounces")
-                .addProperty("gateway", gatewayProperty)
-                .build())
+                .addProperty("gateway", gatewayProperty))
             .build();
     }
 
@@ -450,8 +438,7 @@ public class GatewayRemoteDeliveryIntegrationTest {
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(RemoveMimeHeader.class)
-                .addProperty("name", "bcc")
-                .build())
+                .addProperty("name", "bcc"))
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(RemoteDelivery.class)
@@ -461,8 +448,7 @@ public class GatewayRemoteDeliveryIntegrationTest {
                 .addProperty("maxDnsProblemRetries", "0")
                 .addProperty("deliveryThreads", "2")
                 .addProperty("sendpartial", "true")
-                .addProperty("bounceProcessor", "bounces")
-                .build())
+                .addProperty("bounceProcessor", "bounces"))
             .build();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java
index e70d4e4..e5750bb 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java
@@ -79,7 +79,7 @@ public class NetworkMatcherIntegrationTest {
         MailetContainer mailetContainer = MailetContainer.builder()
             .postmaster("postmaster@" + JAMES_APACHE_ORG)
             .threads(5)
-            .addProcessor(rootProcessor.build())
+            .addProcessor(rootProcessor)
             .addProcessor(CommonProcessors.error())
             .addProcessor(deliverOnlyTransport())
             .build();
@@ -100,21 +100,18 @@ public class NetworkMatcherIntegrationTest {
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(RemoveMimeHeader.class)
-                .addProperty("name", "bcc")
-                .build())
+                .addProperty("name", "bcc"))
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
-                .mailet(LocalDelivery.class)
-                .build())
+                .mailet(LocalDelivery.class))
             .build();
     }
 
-    private MailetConfiguration toRepository() {
+    private MailetConfiguration.Builder toRepository() {
         return MailetConfiguration.builder()
             .matcher(All.class)
             .mailet(ToRepository.class)
-            .addProperty("repositoryPath", DROPPED_MAILS)
-            .build();
+            .addProperty("repositoryPath", DROPPED_MAILS);
     }
 
     @After
@@ -130,8 +127,7 @@ public class NetworkMatcherIntegrationTest {
                 .matcher(RemoteAddrInNetwork.class)
                 .matcherCondition("127.0.0.0/8")
                 .mailet(ToProcessor.class)
-                .addProperty("processor", "transport")
-                .build())
+                .addProperty("processor", "transport"))
             .addMailet(toRepository()));
 
         try (SMTPMessageSender messageSender =
@@ -154,8 +150,7 @@ public class NetworkMatcherIntegrationTest {
                 .matcher(RemoteAddrNotInNetwork.class)
                 .matcherCondition("172.0.0.0/8")
                 .mailet(ToProcessor.class)
-                .addProperty("processor", "transport")
-                .build())
+                .addProperty("processor", "transport"))
             .addMailet(toRepository()));
 
         try (SMTPMessageSender messageSender =
@@ -178,8 +173,7 @@ public class NetworkMatcherIntegrationTest {
                 .matcher(RemoteAddrInNetwork.class)
                 .matcherCondition("127.0.0.0/2")
                 .mailet(ToProcessor.class)
-                .addProperty("processor", "transport")
-                .build())
+                .addProperty("processor", "transport"))
             .addMailet(toRepository()));
 
         try (SMTPMessageSender messageSender =
@@ -202,8 +196,7 @@ public class NetworkMatcherIntegrationTest {
                 .matcher(RemoteAddrInNetwork.class)
                 .matcherCondition("127.0.4.108/8")
                 .mailet(ToProcessor.class)
-                .addProperty("processor", "transport")
-                .build())
+                .addProperty("processor", "transport"))
             .addMailet(toRepository()));
 
         try (SMTPMessageSender messageSender =
@@ -226,8 +219,7 @@ public class NetworkMatcherIntegrationTest {
                 .matcher(RemoteAddrInNetwork.class)
                 .matcherCondition("127.255.255.255/8")
                 .mailet(ToProcessor.class)
-                .addProperty("processor", "transport")
-                .build())
+                .addProperty("processor", "transport"))
             .addMailet(toRepository()));
 
         try (SMTPMessageSender messageSender =
@@ -250,8 +242,7 @@ public class NetworkMatcherIntegrationTest {
                 .matcher(RemoteAddrInNetwork.class)
                 .matcherCondition("126.0.0.0/4")
                 .mailet(ToProcessor.class)
-                .addProperty("processor", "transport")
-                .build())
+                .addProperty("processor", "transport"))
             .addMailet(toRepository()));
 
         try (SMTPMessageSender messageSender =
@@ -274,8 +265,7 @@ public class NetworkMatcherIntegrationTest {
                 .matcher(RemoteAddrInNetwork.class)
                 .matcherCondition("172.0.0.0/8")
                 .mailet(ToProcessor.class)
-                .addProperty("processor", "transport")
-                .build())
+                .addProperty("processor", "transport"))
             .addMailet(toRepository()));
 
         try (SMTPMessageSender messageSender =
@@ -300,8 +290,7 @@ public class NetworkMatcherIntegrationTest {
                 .matcher(RemoteAddrNotInNetwork.class)
                 .matcherCondition("127.0.0.0/8")
                 .mailet(ToProcessor.class)
-                .addProperty("processor", "transport")
-                .build())
+                .addProperty("processor", "transport"))
             .addMailet(toRepository()));
 
         try (SMTPMessageSender messageSender =

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java
index 070eb09..19393a7 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java
@@ -71,13 +71,11 @@ public class SmtpAuthIntegrationTest {
             .addMailet(MailetConfiguration.builder()
                 .matcher(SMTPAuthSuccessful.class)
                 .mailet(ToProcessor.class)
-                .addProperty("processor", "transport")
-                .build())
+                .addProperty("processor", "transport"))
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(ToProcessor.class)
-                .addProperty("processor", "bounces")
-                .build())
+                .addProperty("processor", "bounces"))
             .build();
 
         MailetContainer mailetContainer = MailetContainer.builder()
@@ -113,12 +111,10 @@ public class SmtpAuthIntegrationTest {
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(RemoveMimeHeader.class)
-                .addProperty("name", "bcc")
-                .build())
+                .addProperty("name", "bcc"))
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
-                .mailet(LocalDelivery.class)
-                .build())
+                .mailet(LocalDelivery.class))
             .build();
     }
 
@@ -129,8 +125,7 @@ public class SmtpAuthIntegrationTest {
             .addMailet(MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(ToRepository.class)
-                .addProperty("repositoryPath", DROPPED_MAILS)
-                .build())
+                .addProperty("repositoryPath", DROPPED_MAILS))
             .build();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/CommonProcessors.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/CommonProcessors.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/CommonProcessors.java
index 7e5938e..9f52fc3 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/CommonProcessors.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/CommonProcessors.java
@@ -55,53 +55,44 @@ public class CommonProcessors {
                 .enableJmx(true)
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
-                        .mailet(PostmasterAlias.class)
-                        .build())
+                        .mailet(PostmasterAlias.class))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(RelayLimit.class)
                         .matcherCondition("30")
-                        .mailet(Null.class)
-                        .build())
+                        .mailet(Null.class))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(RecipientIs.class)
                         .matcherCondition("sievemanager@james.linagora.com")
                         .mailet(ToProcessor.class)
-                        .addProperty("processor", "sieve-manager-check")
-                        .build())
+                        .addProperty("processor", "sieve-manager-check"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(HasMailAttribute.class)
                         .matcherCondition("spamChecked")
                         .mailet(ToProcessor.class)
-                        .addProperty("processor", "transport")
-                        .build())
+                        .addProperty("processor", "transport"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(SetMailAttribute.class)
-                        .addProperty("spamChecked", "true")
-                        .build())
+                        .addProperty("spamChecked", "true"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(SMTPAuthSuccessful.class)
                         .mailet(ToProcessor.class)
-                        .addProperty("processor", "transport")
-                        .build())
+                        .addProperty("processor", "transport"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(InSpammerBlacklist.class)
                         .matcherCondition("query.bondedsender.org.")
                         .mailet(ToProcessor.class)
-                        .addProperty("processor", "transport")
-                        .build())
+                        .addProperty("processor", "transport"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(InSpammerBlacklist.class)
                         .matcherCondition("dnsbl.njabl.org.")
                         .mailet(ToProcessor.class)
                         .addProperty("processor", "spam")
-                        .addProperty("notice", "550 Requested action not taken: rejected - see http://njabl.org/")
-                        .build())
+                        .addProperty("notice", "550 Requested action not taken: rejected - see http://njabl.org/"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(ToProcessor.class)
-                        .addProperty("processor", "transport")
-                        .build())
+                        .addProperty("processor", "transport"))
                 .build();
     }
 
@@ -111,13 +102,11 @@ public class CommonProcessors {
                 .enableJmx(true)
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
-                        .mailet(Bounce.class)
-                        .build())
+                        .mailet(Bounce.class))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(ToRepository.class)
-                        .addProperty("repositoryPath", ERROR_REPOSITORY)
-                        .build())
+                        .addProperty("repositoryPath", ERROR_REPOSITORY))
                 .build();
     }
 
@@ -129,40 +118,32 @@ public class CommonProcessors {
                         .matcher(SMTPAuthSuccessful.class)
                         .mailet(SetMimeHeader.class)
                         .addProperty("name", "X-UserIsAuth")
-                        .addProperty("value", "true")
-                        .build())
+                        .addProperty("value", "true"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(HasMailAttribute.class)
                         .matcherCondition("org.apache.james.SMIMECheckSignature")
                         .mailet(SetMimeHeader.class)
                         .addProperty("name", "X-WasSigned")
-                        .addProperty("value", "true")
-                        .build())
+                        .addProperty("value", "true"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(RemoveMimeHeader.class)
-                        .addProperty("name", "bcc")
-                        .build())
+                        .addProperty("name", "bcc"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
-                        .mailet(RecipientRewriteTable.class)
-                        .build())
+                        .mailet(RecipientRewriteTable.class))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(RecipientIsLocal.class)
-                        .mailet(VacationMailet.class)
-                        .build())
+                        .mailet(VacationMailet.class))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(RecipientIsLocal.class)
-                        .mailet(Sieve.class)
-                        .build())
+                        .mailet(Sieve.class))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(RecipientIsLocal.class)
-                        .mailet(AddDeliveredToHeader.class)
-                        .build())
+                        .mailet(AddDeliveredToHeader.class))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(RecipientIsLocal.class)
-                        .mailet(LocalDelivery.class)
-                        .build())
+                        .mailet(LocalDelivery.class))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(SMTPAuthSuccessful.class)
                         .mailet(RemoteDelivery.class)
@@ -172,13 +153,11 @@ public class CommonProcessors {
                         .addProperty("maxDnsProblemRetries", "0")
                         .addProperty("deliveryThreads", "10")
                         .addProperty("sendpartial", "true")
-                        .addProperty("bounceProcessor", "bounces")
-                        .build())
+                        .addProperty("bounceProcessor", "bounces"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(ToProcessor.class)
-                        .addProperty("processor", "relay-denied")
-                        .build())
+                        .addProperty("processor", "relay-denied"))
                 .build();
     }
 
@@ -189,8 +168,7 @@ public class CommonProcessors {
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(ToRepository.class)
-                        .addProperty("repositoryPath", "file://var/mail/spam/")
-                        .build())
+                        .addProperty("repositoryPath", "file://var/mail/spam/"))
                 .build();
     }
 
@@ -201,13 +179,11 @@ public class CommonProcessors {
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(Bounce.class)
-                        .addProperty("attachment", "none")
-                        .build())
+                        .addProperty("attachment", "none"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(ToRepository.class)
-                        .addProperty("repositoryPath", "file://var/mail/address-error/")
-                        .build())
+                        .addProperty("repositoryPath", "file://var/mail/address-error/"))
                 .build();
     }
 
@@ -218,14 +194,12 @@ public class CommonProcessors {
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(Bounce.class)
-                        .addProperty("attachment", "none")
-                        .build())
+                        .addProperty("attachment", "none"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(ToRepository.class)
                         .addProperty("repositoryPath", "file://var/mail/relay-denied/")
-                        .addProperty("notice", "Warning: You are sending an e-mail to a remote server. You must be authentified to perform such an operation")
-                        .build())
+                        .addProperty("notice", "Warning: You are sending an e-mail to a remote server. You must be authentified to perform such an operation"))
                 .build();
     }
 
@@ -236,8 +210,7 @@ public class CommonProcessors {
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(DSNBounce.class)
-                        .addProperty("passThrough", "false")
-                        .build())
+                        .addProperty("passThrough", "false"))
                 .build();
     }
 
@@ -248,8 +221,7 @@ public class CommonProcessors {
                 .addMailet(MailetConfiguration.builder()
                         .matcher(RecipientIsLocal.class)
                         .mailet(ToProcessor.class)
-                        .addProperty("processor", "sieve-manager")
-                        .build())
+                        .addProperty("processor", "sieve-manager"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(Bounce.class)
@@ -257,12 +229,10 @@ public class CommonProcessors {
                         .addProperty("attachment", "none")
                         .addProperty("passThrough", "false")
                         .addProperty("prefix", "[REJECTED]")
-                        .addProperty("notice", "You can't send messages to configure SIEVE on this serveur unless you are the official SIEVE manager.")
-                        .build())
+                        .addProperty("notice", "You can't send messages to configure SIEVE on this serveur unless you are the official SIEVE manager."))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
-                        .mailet(Null.class)
-                        .build())
+                        .mailet(Null.class))
                 .build();
     }
 
@@ -273,17 +243,14 @@ public class CommonProcessors {
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(SetMailAttribute.class)
-                        .addProperty(Mail.SMTP_AUTH_USER_ATTRIBUTE_NAME, "true")
-                        .build())
+                        .addProperty(Mail.SMTP_AUTH_USER_ATTRIBUTE_NAME, "true"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(ManageSieveMailet.class)
-                        .addProperty("helpURL", "file:/root/james-server-app-3.0.0-beta5-SNAPSHOT/conf/managesieve.help.txt")
-                        .build())
+                        .addProperty("helpURL", "file:/root/james-server-app-3.0.0-beta5-SNAPSHOT/conf/managesieve.help.txt"))
                 .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
-                        .mailet(Null.class)
-                        .build())
+                        .mailet(Null.class))
                 .build();
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetContainer.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetContainer.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetContainer.java
index ae71091..7dfc216 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetContainer.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetContainer.java
@@ -57,6 +57,11 @@ public class MailetContainer implements SerializableAsXml {
             return this;
         }
 
+        public Builder addProcessor(ProcessorConfiguration.Builder processorConfiguration) {
+            this.processors.add(processorConfiguration.build());
+            return this;
+        }
+
         public MailetContainer build() {
             Preconditions.checkState(!Strings.isNullOrEmpty(postmaster), "'postmaster' is mandatory");
             Preconditions.checkState(threads > 0, "'threads' should be greater than 0");

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/ProcessorConfiguration.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/ProcessorConfiguration.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/ProcessorConfiguration.java
index e1de38d..5faa8be 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/ProcessorConfiguration.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/ProcessorConfiguration.java
@@ -61,6 +61,11 @@ public class ProcessorConfiguration implements SerializableAsXml {
             return this;
         }
 
+        public Builder addMailet(MailetConfiguration.Builder mailetConfiguration) {
+            this.mailets.add(mailetConfiguration.build());
+            return this;
+        }
+
         public ProcessorConfiguration build() {
             Preconditions.checkState(!Strings.isNullOrEmpty(state), "'state' is mandatory");
             return new ProcessorConfiguration(state, enableJmx.orElse(false), mailets.build());

http://git-wip-us.apache.org/repos/asf/james-project/blob/0df7c31b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
index d8084dc..05e6318 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
@@ -83,25 +83,20 @@ public class SMIMEDecryptIntegrationTest {
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
                     .mailet(RemoveMimeHeader.class)
-                    .addProperty("name", "bcc")
-                    .build())
+                    .addProperty("name", "bcc"))
                 .addMailet(MailetConfiguration.builder()
                     .mailet(SMIMEDecrypt.class)
                     .matcher(All.class)
                     .addProperty("keyStoreFileName", temporaryFolder.getRoot().getAbsoluteFile().getAbsolutePath() + "/conf/smime.p12")
                     .addProperty("keyStorePassword", "secret")
                     .addProperty("keyStoreType", "PKCS12")
-                    .addProperty("debug", "true")
-                    .build())
+                    .addProperty("debug", "true"))
                 .addMailet(MailetConfiguration.builder()
                     .matcher(RecipientIsLocal.class)
-                    .mailet(VacationMailet.class)
-                    .build())
+                    .mailet(VacationMailet.class))
                 .addMailet(MailetConfiguration.builder()
                     .matcher(RecipientIsLocal.class)
-                    .mailet(LocalDelivery.class)
-                    .build())
-                .build())
+                    .mailet(LocalDelivery.class)))
             .build();
 
         jamesServer = TemporaryJamesServer.builder()


---------------------------------------------------------------------
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