james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rouaz...@apache.org
Subject [32/50] [abbrv] james-project git commit: MAILET-115 Introduce builder for FakeMailetConfig
Date Wed, 11 Jan 2017 09:26:20 GMT
MAILET-115 Introduce builder for FakeMailetConfig


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

Branch: refs/heads/master
Commit: 3f90dc107a159ace5829c5bd4d9c0ef74932d584
Parents: 4c64d47
Author: Antoine Duprat <aduprat@apache.org>
Authored: Tue Nov 22 13:13:46 2016 +0100
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Wed Jan 11 10:03:31 2017 +0700

----------------------------------------------------------------------
 .../mailet/base/test/FakeMailetConfig.java      |   3 +-
 .../james/transport/mailets/DSNBounceTest.java  |  86 ++++--
 .../james/transport/mailets/ForwardTest.java    |  87 ++++--
 .../transport/mailets/NotifyPostmasterTest.java |  45 ++-
 .../transport/mailets/NotifySenderTest.java     |  52 +++-
 .../james/transport/mailets/RedirectTest.java   | 190 ++++++++-----
 .../james/transport/mailets/ResendTest.java     |  70 +++--
 .../NotifyMailetInitParametersTest.java         | 265 ++++++++++--------
 .../RedirectMailetInitParametersTest.java       | 279 +++++++++++--------
 9 files changed, 675 insertions(+), 402 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/3f90dc10/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java
----------------------------------------------------------------------
diff --git a/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java b/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java
index 23dff08..03d741c 100644
--- a/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java
+++ b/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMailetConfig.java
@@ -38,6 +38,7 @@ public class FakeMailetConfig implements MailetConfig {
 
     public static class Builder {
 
+        private static final String DEFAULT_MAILET_NAME = "A Mailet";
         private Optional<String> mailetName;
         private Optional<MailetContext> mailetContext;
         private Properties properties;
@@ -64,7 +65,7 @@ public class FakeMailetConfig implements MailetConfig {
         }
 
         public FakeMailetConfig build() {
-            return new FakeMailetConfig(mailetName.or("A Mailet"), 
+            return new FakeMailetConfig(mailetName.or(DEFAULT_MAILET_NAME), 
                     mailetContext.or(FakeMailContext.defaultContext()), 
                     properties);
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/3f90dc10/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 d64546e..b47257c 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
@@ -96,8 +96,11 @@ public class DSNBounceTest {
 
     @Test
     public void initShouldFailWhenUnknownParameterIsConfigured() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("unknwon", "value");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("unknwon", "value")
+                .build();
         expectedException.expect(MessagingException.class);
 
         dsnBounce.init(mailetConfig);
@@ -121,7 +124,10 @@ public class DSNBounceTest {
 
     @Test
     public void serviceShouldSendMultipartMailToTheSender() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         dsnBounce.init(mailetConfig);
 
         MailAddress senderMailAddress = new MailAddress("sender@domain.com");
@@ -149,7 +155,10 @@ public class DSNBounceTest {
 
     @Test
     public void serviceShouldSendMultipartMailContainingTextPart() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         dsnBounce.init(mailetConfig);
 
         MailAddress senderMailAddress = new MailAddress("sender@domain.com");
@@ -187,8 +196,11 @@ public class DSNBounceTest {
 
     @Test
     public void serviceShouldSendMultipartMailContainingTextPartWhenCustomMessageIsConfigured() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("messageString", "My custom message\n");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("messageString", "My custom message\n")
+                .build();
         dsnBounce.init(mailetConfig);
 
         MailAddress senderMailAddress = new MailAddress("sender@domain.com");
@@ -225,7 +237,10 @@ public class DSNBounceTest {
 
     @Test
     public void serviceShouldSendMultipartMailContainingDSNPart() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         dsnBounce.init(mailetConfig);
 
         MailAddress senderMailAddress = new MailAddress("sender@domain.com");
@@ -262,8 +277,11 @@ public class DSNBounceTest {
 
     @Test
     public void serviceShouldUpdateTheMailStateWhenNoSenderAndPassThroughIsFalse() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("passThrough", "false");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("passThrough", "false")
+                .build();
         dsnBounce.init(mailetConfig);
 
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));
@@ -284,7 +302,10 @@ public class DSNBounceTest {
 
     @Test
     public void serviceShouldNotUpdateTheMailStateWhenNoSenderPassThroughHasDefaultValue() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         dsnBounce.init(mailetConfig);
 
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));
@@ -305,8 +326,11 @@ public class DSNBounceTest {
 
     @Test
     public void serviceShouldNotUpdateTheMailStateWhenNoSenderPassThroughIsTrue() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("passThrough", "true");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("passThrough", "true")
+                .build();
         dsnBounce.init(mailetConfig);
 
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));
@@ -327,8 +351,11 @@ public class DSNBounceTest {
 
     @Test
     public void serviceShouldNotAttachTheOriginalMailWhenAttachmentIsEqualToNone() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("attachment", "none");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("attachment", "none")
+                .build();
         dsnBounce.init(mailetConfig);
 
         MailAddress senderMailAddress = new MailAddress("sender@domain.com");
@@ -356,8 +383,11 @@ public class DSNBounceTest {
 
     @Test
     public void serviceShouldAttachTheOriginalMailWhenAttachmentIsEqualToAll() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("attachment", "all");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("attachment", "all")
+                .build();
         dsnBounce.init(mailetConfig);
 
         MailAddress senderMailAddress = new MailAddress("sender@domain.com");
@@ -385,8 +415,11 @@ public class DSNBounceTest {
 
     @Test
     public void serviceShouldAttachTheOriginalMailHeadersOnlyWhenAttachmentIsEqualToHeads() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("attachment", "heads");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("attachment", "heads")
+                .build();
         dsnBounce.init(mailetConfig);
 
         MailAddress senderMailAddress = new MailAddress("sender@domain.com");
@@ -419,7 +452,10 @@ public class DSNBounceTest {
 
     @Test
     public void serviceShouldSetTheDateHeaderWhenNone() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         dsnBounce.init(mailetConfig);
 
         MailAddress senderMailAddress = new MailAddress("sender@domain.com");
@@ -446,7 +482,10 @@ public class DSNBounceTest {
 
     @Test
     public void serviceShouldNotModifyTheDateHeaderWhenAlreadyPresent() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         dsnBounce.init(mailetConfig);
 
         MailAddress senderMailAddress = new MailAddress("sender@domain.com");
@@ -475,8 +514,11 @@ public class DSNBounceTest {
 
     @Test
     public void dsnBounceShouldAddPrefixToSubjectWhenPrefixIsConfigured() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("prefix", "pre");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("prefix", "pre")
+                .build();
         dsnBounce.init(mailetConfig);
 
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));

http://git-wip-us.apache.org/repos/asf/james-project/blob/3f90dc10/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java
index a68fc16..6ab65ff 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java
@@ -72,8 +72,11 @@ public class ForwardTest {
 
     @Test
     public void initShouldThrowWhenUnkownParameter() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("unknown", "error");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("unknown", "error")
+                .build();
         expectedException.expect(MessagingException.class);
 
         forward.init(mailetConfig);
@@ -81,20 +84,26 @@ public class ForwardTest {
 
     @Test
     public void initShouldNotThrowWhenEveryParameters() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("debug", "true");
-        mailetConfig.setProperty("passThrough", "false");
-        mailetConfig.setProperty("fakeDomainCheck", "false");
-        mailetConfig.setProperty("forwardto", "other@james.org");
-        mailetConfig.setProperty("forwardTo", "other@james.org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("debug", "true")
+                .setProperty("passThrough", "false")
+                .setProperty("fakeDomainCheck", "false")
+                .setProperty("forwardto", "other@james.org")
+                .setProperty("forwardTo", "other@james.org")
+                .build();
 
         forward.init(mailetConfig);
     }
 
     @Test
     public void initShouldThrowWhenNoForwardToParameters() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("isStatic", "true");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("isStatic", "true")
+                .build();
         expectedException.expect(MessagingException.class);
 
         forward.init(mailetConfig);
@@ -102,9 +111,12 @@ public class ForwardTest {
 
     @Test
     public void initShouldThrowWhenUnparsableForwardToAddress() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("isStatic", "true");
-        mailetConfig.setProperty("forwardTo", "user@james@org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("isStatic", "true")
+                .setProperty("forwardTo", "user@james@org")
+                .build();
         expectedException.expect(MessagingException.class);
 
         forward.init(mailetConfig);
@@ -112,9 +124,12 @@ public class ForwardTest {
 
     @Test
     public void initShouldThrowWhenForwardToIsEmpty() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("isStatic", "true");
-        mailetConfig.setProperty("forwardTo", "");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("isStatic", "true")
+                .setProperty("forwardTo", "")
+                .build();
         expectedException.expect(MessagingException.class);
 
         forward.init(mailetConfig);
@@ -142,11 +157,14 @@ public class ForwardTest {
 
     @Test
     public void getRecipientsShouldReturnRecipientsWhenForwardtoParameters() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("forwardto",
-                MailAddressFixture.ANY_AT_JAMES.toString() +
-                ", " + 
-                MailAddressFixture.OTHER_AT_JAMES.toString());
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("forwardto",
+                        MailAddressFixture.ANY_AT_JAMES.toString() +
+                        ", " + 
+                        MailAddressFixture.OTHER_AT_JAMES.toString())
+                .build();
         forward.init(mailetConfig);
 
         Collection<MailAddress> recipients = forward.getRecipients();
@@ -155,11 +173,14 @@ public class ForwardTest {
 
     @Test
     public void getRecipientsShouldReturnRecipientsWhenForwardToParameters() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("forwardTo",
-                MailAddressFixture.ANY_AT_JAMES.toString() +
-                ", " + 
-                MailAddressFixture.OTHER_AT_JAMES.toString());
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("forwardTo",
+                        MailAddressFixture.ANY_AT_JAMES.toString() +
+                        ", " + 
+                        MailAddressFixture.OTHER_AT_JAMES.toString())
+                .build();
         forward.init(mailetConfig);
 
         Collection<MailAddress> recipients = forward.getRecipients();
@@ -168,8 +189,11 @@ public class ForwardTest {
 
     @Test
     public void getRecipientsShouldReturnSpecialAddressWhenForwardToIsMatchingOne() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("forwardTo", "postmaster");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("forwardTo", "postmaster")
+                .build();
         forward.init(mailetConfig);
 
         assertThat(forward.getRecipients()).containsOnly(postmaster);
@@ -177,8 +201,11 @@ public class ForwardTest {
 
     @Test
     public void forwardShouldNotModifySubject() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("forwardTo", "other@james.org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("forwardTo", "other@james.org")
+                .build();
         forward.init(mailetConfig);
 
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));

http://git-wip-us.apache.org/repos/asf/james-project/blob/3f90dc10/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
index 17ac3d2..aca75e9 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
@@ -77,8 +77,11 @@ public class NotifyPostmasterTest {
 
     @Test
     public void initShouldFailWhenUnknownParameterIsConfigured() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("unknwon", "value");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("unknwon", "value")
+                .build();
         expectedException.expect(MessagingException.class);
 
         notifyPostmaster.init(mailetConfig);
@@ -86,7 +89,10 @@ public class NotifyPostmasterTest {
 
     @Test
     public void getRecipientsShouldReturnPostmaster() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         notifyPostmaster.init(mailetConfig);
 
         assertThat(notifyPostmaster.getRecipients()).containsOnly(postmaster);
@@ -94,7 +100,10 @@ public class NotifyPostmasterTest {
 
     @Test
     public void getToShouldReturnPostmasterWhenToIsNotconfigured() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         notifyPostmaster.init(mailetConfig);
 
         assertThat(notifyPostmaster.getTo()).containsOnly(postmaster.toInternetAddress());
@@ -102,8 +111,11 @@ public class NotifyPostmasterTest {
 
     @Test
     public void getToShouldReturnPostmasterWhenToIsEqualToPostmaster() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("to", "postmaster");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("to", "postmaster")
+                .build();
         notifyPostmaster.init(mailetConfig);
 
         assertThat(notifyPostmaster.getTo()).containsOnly(postmaster.toInternetAddress());
@@ -111,8 +123,11 @@ public class NotifyPostmasterTest {
 
     @Test
     public void getToShouldReturnUnalteredWhenToIsEqualToUnaltered() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("to", "unaltered");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("to", "unaltered")
+                .build();
         notifyPostmaster.init(mailetConfig);
 
         assertThat(notifyPostmaster.getTo()).containsOnly(SpecialAddress.UNALTERED.toInternetAddress());
@@ -120,8 +135,11 @@ public class NotifyPostmasterTest {
 
     @Test
     public void getToShouldReturnPostmasterWhenToIsNotEqualToPostmasterOrUnaltered() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("to", "otherTo");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("to", "otherTo")
+                .build();
         notifyPostmaster.init(mailetConfig);
 
         assertThat(notifyPostmaster.getTo()).containsOnly(postmaster.toInternetAddress());
@@ -129,8 +147,11 @@ public class NotifyPostmasterTest {
 
     @Test
     public void notifyPostmasterShouldAddPrefixToSubjectWhenPrefixIsConfigured() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("prefix", "pre");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("prefix", "pre")
+                .build();
         notifyPostmaster.init(mailetConfig);
 
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));

http://git-wip-us.apache.org/repos/asf/james-project/blob/3f90dc10/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
index d0e17f8..b800abc 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
@@ -77,8 +77,11 @@ public class NotifySenderTest {
 
     @Test
     public void initShouldFailWhenUnknownParameterIsConfigured() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("unknwon", "value");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("unknwon", "value")
+                .build();
         expectedException.expect(MessagingException.class);
 
         notifySender.init(mailetConfig);
@@ -86,7 +89,10 @@ public class NotifySenderTest {
 
     @Test
     public void getRecipientsShouldReturnSender() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         notifySender.init(mailetConfig);
 
         assertThat(notifySender.getRecipients()).containsOnly(SpecialAddress.SENDER);
@@ -94,7 +100,10 @@ public class NotifySenderTest {
 
     @Test
     public void getToShouldReturnSenderWhenToIsNotconfigured() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         notifySender.init(mailetConfig);
 
         assertThat(notifySender.getTo()).containsOnly(SpecialAddress.SENDER.toInternetAddress());
@@ -102,8 +111,11 @@ public class NotifySenderTest {
 
     @Test
     public void getToShouldReturnSenderWhenToIsEqualToSender() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("to", "sender");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("to", "sender")
+                .build();
         notifySender.init(mailetConfig);
 
         assertThat(notifySender.getTo()).containsOnly(SpecialAddress.SENDER.toInternetAddress());
@@ -111,8 +123,11 @@ public class NotifySenderTest {
 
     @Test
     public void getToShouldReturnUnalteredWhenToIsEqualToUnaltered() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("to", "unaltered");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("to", "unaltered")
+                .build();
         notifySender.init(mailetConfig);
 
         assertThat(notifySender.getTo()).containsOnly(SpecialAddress.UNALTERED.toInternetAddress());
@@ -120,8 +135,11 @@ public class NotifySenderTest {
 
     @Test
     public void getToShouldReturnFromWhenToIsEqualToFrom() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("to", "from");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("to", "from")
+                .build();
         notifySender.init(mailetConfig);
 
         assertThat(notifySender.getTo()).containsOnly(SpecialAddress.FROM.toInternetAddress());
@@ -129,8 +147,11 @@ public class NotifySenderTest {
 
     @Test
     public void getToShouldReturnSenderWhenToIsNotEqualToSenderUnalteredOrFrom() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("to", "otherTo");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("to", "otherTo")
+                .build();
         notifySender.init(mailetConfig);
 
         assertThat(notifySender.getTo()).containsOnly(SpecialAddress.SENDER.toInternetAddress());
@@ -138,8 +159,11 @@ public class NotifySenderTest {
 
     @Test
     public void notifySenderShouldAddPrefixToSubjectWhenPrefixIsConfigured() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("prefix", "pre");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("prefix", "pre")
+                .build();
         notifySender.init(mailetConfig);
 
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));

http://git-wip-us.apache.org/repos/asf/james-project/blob/3f90dc10/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java
index 8a4b3db..cf386f8 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java
@@ -73,8 +73,11 @@ public class RedirectTest {
 
     @Test
     public void initShouldThrowWhenUnkownParameter() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("unknown", "error");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("unknown", "error")
+                .build();
         expectedException.expect(MessagingException.class);
 
         redirect.init(mailetConfig);
@@ -82,31 +85,37 @@ public class RedirectTest {
 
     @Test
     public void initShouldNotThrowWhenEveryParameters() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("static", "true");
-        mailetConfig.setProperty("debug", "true");
-        mailetConfig.setProperty("passThrough", "false");
-        mailetConfig.setProperty("fakeDomainCheck", "false");
-        mailetConfig.setProperty("inline", "true");
-        mailetConfig.setProperty("attachment", "true");
-        mailetConfig.setProperty("message", "mess");
-        mailetConfig.setProperty("recipients", "user@james.org, user2@james.org");
-        mailetConfig.setProperty("to", "to@james.org");
-        mailetConfig.setProperty("replyTo", "replyTo@james.org");
-        mailetConfig.setProperty("replyto", "replyto@james.org");
-        mailetConfig.setProperty("reversePath", "reverse@james.org");
-        mailetConfig.setProperty("sender", "sender@james.org");
-        mailetConfig.setProperty("subject", "subj");
-        mailetConfig.setProperty("prefix", "pref");
-        mailetConfig.setProperty("attachError", "true");
-        mailetConfig.setProperty("isReply", "true");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("static", "true")
+                .setProperty("debug", "true")
+                .setProperty("passThrough", "false")
+                .setProperty("fakeDomainCheck", "false")
+                .setProperty("inline", "true")
+                .setProperty("attachment", "true")
+                .setProperty("message", "mess")
+                .setProperty("recipients", "user@james.org, user2@james.org")
+                .setProperty("to", "to@james.org")
+                .setProperty("replyTo", "replyTo@james.org")
+                .setProperty("replyto", "replyto@james.org")
+                .setProperty("reversePath", "reverse@james.org")
+                .setProperty("sender", "sender@james.org")
+                .setProperty("subject", "subj")
+                .setProperty("prefix", "pref")
+                .setProperty("attachError", "true")
+                .setProperty("isReply", "true")
+                .build();
 
         redirect.init(mailetConfig);
     }
 
     @Test
     public void initShouldReturnEmptyWhenNoRecipientsOrToParameters() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         redirect.init(mailetConfig);
 
         assertThat(redirect.getRecipients()).isEmpty();
@@ -114,8 +123,11 @@ public class RedirectTest {
 
     @Test
     public void getRecipientsShouldThrowWhenUnparsableRecipientsAddress() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("recipients", "user@james@org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("recipients", "user@james@org")
+                .build();
         redirect.init(mailetConfig);
 
         expectedException.expect(MessagingException.class);
@@ -124,8 +136,11 @@ public class RedirectTest {
 
     @Test
     public void getRecipientsShouldThrowWhenUnparsableToAddress() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("to", "user@james@org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("to", "user@james@org")
+                .build();
         redirect.init(mailetConfig);
 
         expectedException.expect(MessagingException.class);
@@ -134,9 +149,12 @@ public class RedirectTest {
 
     @Test
     public void getRecipientsShouldThrowWhenRecipientsAndToAreEmpty() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("recipients", "");
-        mailetConfig.setProperty("to", "");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("recipients", "")
+                .setProperty("to", "")
+                .build();
         redirect.init(mailetConfig);
 
         expectedException.expect(MessagingException.class);
@@ -145,8 +163,11 @@ public class RedirectTest {
 
     @Test
     public void getRecipientsShouldReturnSpecialAddressWhenRecipientsIsMatchingOne() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("recipients", "postmaster");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("recipients", "postmaster")
+                .build();
         redirect.init(mailetConfig);
 
         assertThat(redirect.getRecipients()).containsOnly(postmaster);
@@ -154,8 +175,11 @@ public class RedirectTest {
 
     @Test
     public void getToShouldThrowWhenUnparsableRecipientsAddress() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("recipients", "user@james@org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("recipients", "user@james@org")
+                .build();
         redirect.init(mailetConfig);
 
         expectedException.expect(MessagingException.class);
@@ -164,8 +188,11 @@ public class RedirectTest {
 
     @Test
     public void getToShouldThrowWhenUnparsableToAddress() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("to", "user@james@org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("to", "user@james@org")
+                .build();
         redirect.init(mailetConfig);
 
         expectedException.expect(MessagingException.class);
@@ -174,9 +201,12 @@ public class RedirectTest {
 
     @Test
     public void getToShouldThrowWhenRecipientsAndToAreEmpty() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("recipients", "");
-        mailetConfig.setProperty("to", "");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("recipients", "")
+                .setProperty("to", "")
+                .build();
         redirect.init(mailetConfig);
 
         expectedException.expect(MessagingException.class);
@@ -185,8 +215,11 @@ public class RedirectTest {
 
     @Test
     public void getToShouldReturnSpecialAddressWhenRecipientsIsMatchingOne() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("recipients", "postmaster");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("recipients", "postmaster")
+                .build();
         redirect.init(mailetConfig);
 
         assertThat(redirect.getTo()).containsOnly(postmaster.toInternetAddress());
@@ -194,7 +227,10 @@ public class RedirectTest {
 
     @Test
     public void getReversePathShouldReturnNullWhenNoReversePathParameter() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         redirect.init(mailetConfig);
 
         assertThat(redirect.getReversePath()).isNull();
@@ -202,8 +238,11 @@ public class RedirectTest {
 
     @Test
     public void getReversePathShouldThrowWhenUnparsableReversePathParameter() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("reversePath", "reverse@james@org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("reversePath", "reverse@james@org")
+                .build();
         redirect.init(mailetConfig);
 
         expectedException.expect(MessagingException.class);
@@ -212,8 +251,11 @@ public class RedirectTest {
 
     @Test
     public void getReversePathShouldReturnSpecialAddressWhenReversePathIsMatchingOne() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("reversePath", "postmaster");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("reversePath", "postmaster")
+                .build();
         redirect.init(mailetConfig);
 
         assertThat(redirect.getReversePath()).isEqualTo(postmaster);
@@ -221,8 +263,11 @@ public class RedirectTest {
 
     @Test
     public void getReversePathShouldReturnMailAddressWhenReversePathIsGiven() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("reversePath", "reverse@james.org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("reversePath", "reverse@james.org")
+                .build();
         redirect.init(mailetConfig);
 
         assertThat(redirect.getReversePath()).isEqualTo(new MailAddress("reverse@james.org"));
@@ -230,7 +275,10 @@ public class RedirectTest {
 
     @Test
     public void getReversePathWithMailShouldReturnNullWhenNotStaticAndReversePathParameters() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .build();
         redirect.init(mailetConfig);
 
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
@@ -243,8 +291,11 @@ public class RedirectTest {
 
     @Test
     public void getReversePathWithMailShouldReturnReversePathWhenReversePathIsGiven() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("reversePath", "reverse@james.org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("reversePath", "reverse@james.org")
+                .build();
         redirect.init(mailetConfig);
 
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
@@ -257,8 +308,11 @@ public class RedirectTest {
 
     @Test
     public void getReversePathWithMailShouldReturnSpecialAddressWhenReversePathIsMatchingOne() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("reversePath", "postmaster");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("reversePath", "postmaster")
+                .build();
         redirect.init(mailetConfig);
 
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
@@ -271,8 +325,12 @@ public class RedirectTest {
 
     @Test
     public void getReversePathWithMailShouldReturnSpecialAddressWhenNotStaticAndNewReversePathIsMatchingOne() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("static", "false");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("static", "false")
+                .setProperty("reversePath", "postmaster")
+                .build();
         redirect.init(mailetConfig);
 
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
@@ -280,14 +338,16 @@ public class RedirectTest {
         message.setText("This is a fake mail");
         FakeMail mail = FakeMail.from(message);
 
-        mailetConfig.setProperty("reversePath", "postmaster");
         assertThat(redirect.getReversePath(mail)).isEqualTo(postmaster);
     }
 
     @Test
     public void getReversePathWithMailShouldReturnSenderWhenNoReversePath() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("sender", "sender@james.org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("sender", "sender@james.org")
+                .build();
         redirect.init(mailetConfig);
 
         MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
@@ -300,9 +360,12 @@ public class RedirectTest {
 
     @Test
     public void redirectShouldNotModifyOriginalSubject() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("subject", "subj");
-        mailetConfig.setProperty("prefix", "pref");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("subject", "subj")
+                .setProperty("prefix", "pref")
+                .build();
         redirect.init(mailetConfig);
 
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));
@@ -321,9 +384,12 @@ public class RedirectTest {
 
     @Test
     public void redirectShouldAddPrefixAndSubjectToSentMail() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("subject", "subj");
-        mailetConfig.setProperty("prefix", "pre");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("subject", "subj")
+                .setProperty("prefix", "pre")
+                .build();
         redirect.init(mailetConfig);
 
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));

http://git-wip-us.apache.org/repos/asf/james-project/blob/3f90dc10/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
index 30fe804..b3b7e5e 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
@@ -73,8 +73,11 @@ public class ResendTest {
 
     @Test
     public void initShouldThrowWhenUnknownParameter() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("unknown", "error");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("unknown", "error")
+                .build();
         expectedException.expect(MessagingException.class);
 
         resend.init(mailetConfig);
@@ -82,34 +85,40 @@ public class ResendTest {
 
     @Test
     public void initShouldNotThrowWhenEveryParameters() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("debug", "true");
-        mailetConfig.setProperty("passThrough", "false");
-        mailetConfig.setProperty("fakeDomainCheck", "false");
-        mailetConfig.setProperty("inline", "true");
-        mailetConfig.setProperty("attachment", "true");
-        mailetConfig.setProperty("message", "mess");
-        mailetConfig.setProperty("recipients", "user@james.org, user2@james.org");
-        mailetConfig.setProperty("to", "to@james.org");
-        mailetConfig.setProperty("replyTo", "replyTo@james.org");
-        mailetConfig.setProperty("replyto", "replyto@james.org");
-        mailetConfig.setProperty("reversePath", "reverse@james.org");
-        mailetConfig.setProperty("sender", "sender@james.org");
-        mailetConfig.setProperty("subject", "subj");
-        mailetConfig.setProperty("prefix", "pref");
-        mailetConfig.setProperty("attachError", "true");
-        mailetConfig.setProperty("isReply", "true");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("debug", "true")
+                .setProperty("passThrough", "false")
+                .setProperty("fakeDomainCheck", "false")
+                .setProperty("inline", "true")
+                .setProperty("attachment", "true")
+                .setProperty("message", "mess")
+                .setProperty("recipients", "user@james.org, user2@james.org")
+                .setProperty("to", "to@james.org")
+                .setProperty("replyTo", "replyTo@james.org")
+                .setProperty("replyto", "replyto@james.org")
+                .setProperty("reversePath", "reverse@james.org")
+                .setProperty("sender", "sender@james.org")
+                .setProperty("subject", "subj")
+                .setProperty("prefix", "pref")
+                .setProperty("attachError", "true")
+                .setProperty("isReply", "true")
+                .build();
 
         resend.init(mailetConfig);
     }
 
     @Test
     public void resendShouldNotModifyOriginalSubject() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("subject", "subj");
-        mailetConfig.setProperty("prefix", "pref");
-        mailetConfig.setProperty("recipients", "user@james.org, user2@james.org");
-        mailetConfig.setProperty("to", "to@james.org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("subject", "subj")
+                .setProperty("prefix", "pref")
+                .setProperty("recipients", "user@james.org, user2@james.org")
+                .setProperty("to", "to@james.org")
+                .build();
         resend.init(mailetConfig);
 
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));
@@ -128,11 +137,14 @@ public class ResendTest {
 
     @Test
     public void resendShouldAddPrefixAndSubjectToSentMail() throws Exception {
-        FakeMailetConfig mailetConfig = new FakeMailetConfig(MAILET_NAME, fakeMailContext);
-        mailetConfig.setProperty("subject", "subj");
-        mailetConfig.setProperty("prefix", "pre");
-        mailetConfig.setProperty("recipients", "user@james.org, user2@james.org");
-        mailetConfig.setProperty("to", "to@james.org");
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName(MAILET_NAME)
+                .mailetContext(fakeMailContext)
+                .setProperty("subject", "subj")
+                .setProperty("prefix", "pre")
+                .setProperty("recipients", "user@james.org, user2@james.org")
+                .setProperty("to", "to@james.org")
+                .build();
         resend.init(mailetConfig);
 
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));

http://git-wip-us.apache.org/repos/asf/james-project/blob/3f90dc10/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java
index 7f3b152..bcb84f9 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java
@@ -21,13 +21,10 @@ package org.apache.james.transport.mailets.redirect;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import java.util.Properties;
-
 import javax.mail.MessagingException;
 
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
 import org.junit.Before;
 import org.junit.Test;
@@ -48,9 +45,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getPassThroughShouldReturnTrueWhenSetToTrue() throws Exception {
-        Properties properties = new Properties();
-        properties.put("passThrough", "true");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("passThrough", "true")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -60,9 +58,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getPassThroughShouldReturnFalseWhenSetToFalse() throws Exception {
-        Properties properties = new Properties();
-        properties.put("passThrough", "false");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("passThrough", "false")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -72,8 +71,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getPassThroughShouldReturnTrueWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -83,9 +83,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getFakeDomainCheckShouldReturnTrueWhenSetToTrue() throws Exception {
-        Properties properties = new Properties();
-        properties.put("fakeDomainCheck", "true");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("fakeDomainCheck", "true")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -95,9 +96,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getFakeDomainCheckShouldReturnFalseWhenSetToFalse() throws Exception {
-        Properties properties = new Properties();
-        properties.put("fakeDomainCheck", "false");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("fakeDomainCheck", "false")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -107,8 +109,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getFakeDomainCheckShouldReturnFalseWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -118,9 +121,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getInLineTypeShouldReturnValueWhenSet() throws Exception {
-        Properties properties = new Properties();
-        properties.put("inline", "unaltered");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("inline", "unaltered")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -130,8 +134,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getInLineTypeShouldReturnNoneWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -141,9 +146,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getAttachmentTypeShouldReturnValueWhenSet() throws Exception {
-        Properties properties = new Properties();
-        properties.put("attachment", "unaltered");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("attachment", "unaltered")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -153,8 +159,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getAttachmentTypeShouldReturnMessageWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -164,9 +171,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getMessageShouldReturnNoticeValueWhenSet() throws Exception {
-        Properties properties = new Properties();
-        properties.put("notice", "my notice");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("notice", "my notice")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -176,9 +184,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getMessageShouldReturnMessageValueWhenSet() throws Exception {
-        Properties properties = new Properties();
-        properties.put("message", "my message");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("message", "my message")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -188,8 +197,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getMessageShouldReturnDefaultMessageWhenNoticeAndMessageNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -199,8 +209,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getSubjectShouldReturnNull() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -210,9 +221,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getSubjectPrefixShouldReturnValueWhenSet() throws Exception {
-        Properties properties = new Properties();
-        properties.put("prefix", "my prefix");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("prefix", "my prefix")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -222,8 +234,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getSubjectPrefixShouldReturnDefaultValueWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -233,9 +246,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void isAttachErrorShouldReturnTrueWhenSetToTrue() throws Exception {
-        Properties properties = new Properties();
-        properties.put("attachError", "true");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("attachError", "true")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -245,9 +259,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void isAttachErrorShouldReturnFalseWhenSetToFalse() throws Exception {
-        Properties properties = new Properties();
-        properties.put("attachError", "false");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("attachError", "false")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -257,8 +272,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void isAttachErrorShouldReturnFalseWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -268,8 +284,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void isReplyShouldReturnTrue() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -279,9 +296,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getRecipientsShouldReturnValueWhenSet() throws Exception {
-        Properties properties = new Properties();
-        properties.put("recipients", "user@james.org, user2@james.org");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("recipients", "user@james.org, user2@james.org")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -291,9 +309,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getRecipientsShouldReturnNullWhenEmpty() throws Exception {
-        Properties properties = new Properties();
-        properties.put("recipients", "");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("recipients", "")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -303,8 +322,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getRecipientsShouldReturnNullWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -314,9 +334,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getToShouldReturnValueWhenSet() throws Exception {
-        Properties properties = new Properties();
-        properties.put("to", "user@james.org, user2@james.org");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("to", "user@james.org, user2@james.org")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -326,9 +347,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getToShouldReturnNullWhenEmpty() throws Exception {
-        Properties properties = new Properties();
-        properties.put("to", "");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("to", "")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -338,8 +360,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getToShouldReturnNullWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -349,9 +372,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getReversePathShouldReturnValueWhenSet() throws Exception {
-        Properties properties = new Properties();
-        properties.put("reversePath", "user@james.org, user2@james.org");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("reversePath", "user@james.org, user2@james.org")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -361,9 +385,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getReversePathShouldReturnNullWhenEmpty() throws Exception {
-        Properties properties = new Properties();
-        properties.put("reversePath", "");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("reversePath", "")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -373,8 +398,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getReversePathShouldReturnNullWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -384,9 +410,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getSenderShouldReturnValueWhenSet() throws Exception {
-        Properties properties = new Properties();
-        properties.put("sender", "user@james.org, user2@james.org");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("sender", "user@james.org, user2@james.org")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -396,9 +423,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getSenderShouldReturnNullWhenEmpty() throws Exception {
-        Properties properties = new Properties();
-        properties.put("sender", "");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("sender", "")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -408,8 +436,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getSenderShouldReturnNullWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -419,9 +448,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getReplyToShouldReturnValueWhenSet() throws Exception {
-        Properties properties = new Properties();
-        properties.put("replyTo", "user@james.org, user2@james.org");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("replyTo", "user@james.org, user2@james.org")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -431,9 +461,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getReplyToShouldReturnreplytoValueWhenSet() throws Exception {
-        Properties properties = new Properties();
-        properties.put("replyto", "user@james.org, user2@james.org");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("replyto", "user@james.org, user2@james.org")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -443,9 +474,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getReplyToShouldReturnNullWhenEmpty() throws Exception {
-        Properties properties = new Properties();
-        properties.put("replyTo", "");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("replyTo", "")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -455,8 +487,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void getReplyToShouldReturnNullWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -466,9 +499,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void isDebugShouldReturnTrueWhenSetToTrue() throws Exception {
-        Properties properties = new Properties();
-        properties.put("debug", "true");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("debug", "true")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -478,9 +512,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void isDebugShouldReturnFalseWhenSetToFalse() throws Exception {
-        Properties properties = new Properties();
-        properties.put("debug", "false");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("debug", "false")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -490,8 +525,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void isDebugShouldReturnFalseWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -501,9 +537,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void isStaticShouldReturnTrueWhenSetToTrue() throws Exception {
-        Properties properties = new Properties();
-        properties.put("static", "true");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("static", "true")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -513,9 +550,10 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void isStaticShouldReturnFalseWhenSetToFalse() throws Exception {
-        Properties properties = new Properties();
-        properties.put("static", "false");
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .setProperty("static", "false")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 
@@ -525,8 +563,9 @@ public class NotifyMailetInitParametersTest {
 
     @Test
     public void isStaticShouldReturnFalseWhenNotSet() throws Exception {
-        Properties properties = new Properties();
-        FakeMailetConfig mailetConfig = new FakeMailetConfig("mailet", FakeMailContext.defaultContext(), properties);
+        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
+                .mailetName("mailet")
+                .build();
         mailet.init(mailetConfig);
         InitParameters testee = NotifyMailetInitParameters.from(mailet);
 


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