You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ro...@apache.org on 2016/11/25 14:24:21 UTC

[2/2] james-project git commit: MAILET-140 Add a Builder to FakeMatcherConfig and modify all the impacted classes

MAILET-140 Add a Builder to FakeMatcherConfig and modify all the impacted classes


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

Branch: refs/heads/master
Commit: c6855a29f65e663201c1efe2a4a6cc8c2b325666
Parents: def450b
Author: Laura Royet <lr...@linagora.com>
Authored: Mon Nov 21 13:26:49 2016 +0100
Committer: Laura Royet <lr...@linagora.com>
Committed: Fri Nov 25 10:55:06 2016 +0100

----------------------------------------------------------------------
 .../mailet/base/test/FakeMatcherConfig.java     | 74 ++++++++++++++------
 .../matchers/AbstractHasMailAttributeTest.java  | 11 +--
 .../james/transport/matchers/AllTest.java       |  7 +-
 .../transport/matchers/FetchedFromTest.java     |  7 +-
 .../james/transport/matchers/HasHeaderTest.java | 65 +++++++++++++----
 .../matchers/HasMailAttributeTest.java          |  4 +-
 .../HasMailAttributeWithValueRegexTest.java     |  4 +-
 .../matchers/HasMailAttributeWithValueTest.java |  4 +-
 .../transport/matchers/HostIsLocalTest.java     | 10 ++-
 .../james/transport/matchers/HostIsTest.java    | 11 +--
 .../matchers/IsSingleRecipientTest.java         |  5 +-
 .../transport/matchers/NESSpamCheckTest.java    |  6 +-
 .../matchers/RecipientIsLocalTest.java          |  5 +-
 .../matchers/RecipientIsRegexTest.java          | 34 ++++++---
 .../transport/matchers/RecipientIsTest.java     | 30 ++++++--
 .../transport/matchers/RelayLimitTest.java      | 58 ++++++++++-----
 .../matchers/SMTPAuthSuccessfulTest.java        |  2 +-
 .../transport/matchers/SMTPAuthUserIsTest.java  |  4 +-
 .../matchers/SMTPIsAuthNetworkTest.java         |  7 +-
 .../matchers/SenderHostIsLocalTest.java         |  6 +-
 .../transport/matchers/SenderIsLocalTest.java   |  6 +-
 .../transport/matchers/SenderIsNullTest.java    |  5 +-
 .../transport/matchers/SenderIsRegexTest.java   | 34 ++++++---
 .../james/transport/matchers/SenderIsTest.java  | 29 ++++++--
 .../transport/matchers/SizeGreaterThanTest.java | 55 ++++++++++++---
 .../james/transport/matchers/SubjectIsTest.java | 24 ++++---
 .../matchers/SubjectStartsWithTest.java         | 20 ++++--
 .../james/transport/matchers/UserIsTest.java    | 29 ++++++--
 .../matchers/InSpammerBlacklistTest.java        |  8 ++-
 .../matchers/RemoteAddrInNetworkTest.java       | 12 +++-
 .../matchers/RemoteAddrNotInNetworkTest.java    | 12 +++-
 31 files changed, 431 insertions(+), 157 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMatcherConfig.java
----------------------------------------------------------------------
diff --git a/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMatcherConfig.java b/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMatcherConfig.java
index e792f4d..ef1376f 100644
--- a/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMatcherConfig.java
+++ b/mailet/base/src/test/java/org/apache/mailet/base/test/FakeMatcherConfig.java
@@ -22,39 +22,73 @@ package org.apache.mailet.base.test;
 import org.apache.mailet.MailetContext;
 import org.apache.mailet.MatcherConfig;
 
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+
 /**
  * MatcherConfig
  */
 public class FakeMatcherConfig implements MatcherConfig {
 
-    private final String matcherName;
+    public static Builder builder() {
+        return new Builder();
+    }
 
-    private final MailetContext mc;
+    public static class Builder {
 
-    public FakeMatcherConfig(String matcherName, MailetContext mc) {
-        super();
-        this.matcherName = matcherName;
-        this.mc = mc;
-    }
+        private String matcherName;
+        private Optional<MailetContext> mailetContext;
+        private Optional<String> condition;
 
-    public String getCondition() {
-        if (matcherName.contains("=")) {
-            return matcherName.substring(getMatcherName().length() + 1);
-        } else {
-            return null;
+        private Builder() {
+            condition = Optional.absent();
+            mailetContext = Optional.absent();
+        }
+
+        public Builder matcherName(String matcherName) {
+            this.matcherName = matcherName;
+            return this;
+        }
+
+        public Builder mailetContext(MailetContext mailetContext) {
+            Preconditions.checkNotNull(mailetContext);
+            this.mailetContext = Optional.of(mailetContext);
+            return this;
+        }
+
+        public Builder condition(String condition) {
+            this.condition = Optional.fromNullable(condition);
+            return this;
+        }
+
+        public FakeMatcherConfig build() {
+            Preconditions.checkNotNull(matcherName, "'matcherName' is mandatory");
+            return new FakeMatcherConfig(matcherName, mailetContext.or(FakeMailContext.defaultContext()), condition);
         }
     }
 
-    public MailetContext getMailetContext() {
-        return mc;
+    private final String matcherName;
+    private final MailetContext mailetContext;
+    private final Optional<String> condition;
+
+    private FakeMatcherConfig(String matcherName, MailetContext mailetContext, Optional<String> condition) {
+        this.matcherName = matcherName;
+        this.mailetContext = mailetContext;
+        this.condition = condition;
     }
 
+    @Override
     public String getMatcherName() {
-        if (matcherName.contains("=")) {
-            return matcherName.split("=")[0];
-        } else {
-            return matcherName;
-        }
+        return matcherName;
+    }
+
+    @Override
+    public MailetContext getMailetContext() {
+        return mailetContext;
     }
 
-}
+    @Override
+    public String getCondition() {
+        return condition.orNull();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/AbstractHasMailAttributeTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/AbstractHasMailAttributeTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/AbstractHasMailAttributeTest.java
index b6fcfc0..fbef0a7 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/AbstractHasMailAttributeTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/AbstractHasMailAttributeTest.java
@@ -28,7 +28,6 @@ import org.apache.mailet.MailAddress;
 import org.apache.mailet.Matcher;
 import org.apache.mailet.base.GenericMatcher;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.apache.mailet.base.test.MailUtil;
 
@@ -68,9 +67,13 @@ public abstract class AbstractHasMailAttributeTest extends TestCase {
 
     protected void setupMatcher() throws MessagingException {
         matcher = createMatcher();
-        FakeMatcherConfig mci = new FakeMatcherConfig(getConfigOption()
-                + getHasMailAttribute(), FakeMailContext.defaultContext());
+        FakeMatcherConfig mci = FakeMatcherConfig.builder()
+                .matcherName(getMatcherName())
+                .condition(getHasMailAttribute())
+                .build();
+
         matcher.init(mci);
+
     }
 
     // test if the mail attribute was matched
@@ -109,5 +112,5 @@ public abstract class AbstractHasMailAttributeTest extends TestCase {
 
     protected abstract GenericMatcher createMatcher();
 
-    protected abstract String getConfigOption();
+    protected abstract String getMatcherName();
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/AllTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/AllTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/AllTest.java
index f8fde23..a699073 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/AllTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/AllTest.java
@@ -29,7 +29,6 @@ import javax.mail.MessagingException;
 import org.apache.mailet.Mail;
 import org.apache.mailet.Matcher;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Test;
@@ -41,8 +40,10 @@ public class AllTest {
     @Before
     public void setupMatcher() throws MessagingException {
         matcher = new All();
-        FakeMatcherConfig mci = new FakeMatcherConfig("All",
-                FakeMailContext.defaultContext());
+        FakeMatcherConfig mci = FakeMatcherConfig.builder()
+                .matcherName("All")
+                .build();
+
         matcher.init(mci);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/FetchedFromTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/FetchedFromTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/FetchedFromTest.java
index 2f8f0e1..d24bcf5 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/FetchedFromTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/FetchedFromTest.java
@@ -27,7 +27,6 @@ import javax.mail.MessagingException;
 
 import org.apache.mailet.Matcher;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.apache.mailet.base.test.MailUtil;
 import org.junit.Before;
@@ -42,7 +41,11 @@ public class FetchedFromTest {
     @Before
     public void setUp() throws MessagingException {
         matcher = new FetchedFrom();
-        FakeMatcherConfig matcherConfig = new FakeMatcherConfig("FetchedFrom=" + EXPECTED_HEADER_VALUE, FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfig = FakeMatcherConfig.builder()
+                .matcherName("FetchedFrom")
+                .condition(EXPECTED_HEADER_VALUE)
+                .build();
+
         matcher.init(matcherConfig);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasHeaderTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasHeaderTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasHeaderTest.java
index c49000f..49dfc9b 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasHeaderTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasHeaderTest.java
@@ -31,7 +31,6 @@ import javax.mail.internet.MimeMessage;
 import org.apache.mailet.Mail;
 import org.apache.mailet.Matcher;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.apache.mailet.base.test.MailUtil;
 import org.junit.Before;
@@ -56,49 +55,76 @@ public class HasHeaderTest {
 
     @Test
     public void matchShouldReturnAddressesWhenRightHeaderNameWithoutValue() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("HasHeader=" + HEADER_NAME_1, FakeMailContext.defaultContext()));
+
+        FakeMatcherConfig mci = FakeMatcherConfig.builder()
+                .matcherName("HasHeader")
+                .condition(HEADER_NAME_1)
+                .build();
+
+        matcher.init(mci);
+
+
 
         assertThat(matcher.match(mockedMail)).containsAll(mockedMail.getRecipients());
     }
 
     @Test
     public void matchShouldReturnNullWhenWrongHeaderNameWithoutValue() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("HasHeader=" + HEADER_NAME_2, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("HasHeader")
+                .condition(HEADER_NAME_2)
+                .build());
 
         assertThat(matcher.match(mockedMail)).isNull();
     }
 
     @Test
     public void matchShouldReturnAddressesWhenGoodHeaderNameAndValue() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("HasHeader=" + HEADER_NAME_1 + "=" + HEADER_VALUE_1, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("HasHeader")
+                .condition(HEADER_NAME_1 + "=" + HEADER_VALUE_1)
+                .build());
 
         assertThat(matcher.match(mockedMail)).containsAll(mockedMail.getRecipients());
     }
 
     @Test
     public void matchShouldReturnNullWhenWrongValue() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("HasHeader=" + HEADER_NAME_1 + "=" + HEADER_VALUE_2, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("HasHeader")
+                .condition(HEADER_NAME_1 + "=" + HEADER_VALUE_2)
+                .build());
 
         assertThat(matcher.match(mockedMail)).isNull();
     }
 
     @Test
     public void matchShouldReturnNullWhenWrongHeaderNameWithValueSpecified() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("HasHeader=" + HEADER_NAME_2 + "=" + HEADER_VALUE_2, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("HasHeader")
+                .condition(HEADER_NAME_2 + "=" + HEADER_VALUE_2)
+                .build());
 
         assertThat(matcher.match(mockedMail)).isNull();
     }
 
     @Test
     public void matchShouldIgnoreExtraEquals() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("HasHeader=" + HEADER_NAME_1 + "=" + HEADER_VALUE_1 + "=any", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("HasHeader")
+                .condition(HEADER_NAME_1 + "=" + HEADER_VALUE_1 + "=any")
+                .build());
 
         assertThat(matcher.match(mockedMail)).containsAll(mockedMail.getRecipients());
     }
 
     @Test
     public void matchShouldNotMatchMailsWithNoHeaderWhenValueSpecified() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("HasHeader=" + HEADER_NAME_1 + "=" + HEADER_VALUE_1, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("HasHeader")
+                .condition(HEADER_NAME_1 + "=" + HEADER_VALUE_1)
+                .build());
+
         Mail mail = MailUtil.createMockMail2Recipients(MailUtil.createMimeMessage());
 
         assertThat(matcher.match(mail)).isNull();
@@ -106,7 +132,11 @@ public class HasHeaderTest {
 
     @Test
     public void matchShouldNotMatchMailsWithNoHeaderWhenValueNotSpecified() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("HasHeader=" + HEADER_NAME_1, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("HasHeader")
+                .condition(HEADER_NAME_1)
+                .build());
+
         Mail mail = MailUtil.createMockMail2Recipients(MailUtil.createMimeMessage());
 
         assertThat(matcher.match(mail)).isNull();
@@ -114,14 +144,21 @@ public class HasHeaderTest {
 
     @Test
     public void matchShouldReturnNullWhenOneConditionIsNotTrue() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("HasHeader=" + HEADER_NAME_1 + "+" + HEADER_NAME_2, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("HasHeader")
+                .condition(HEADER_NAME_1 + "+" + HEADER_NAME_2)
+                .build());
 
         assertThat(matcher.match(mockedMail)).isNull();
     }
 
     @Test
     public void matchShouldReturnAddressesWhenAllConditionsMatch() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("HasHeader=" + HEADER_NAME_1 + "+" + HEADER_NAME_2, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("HasHeader")
+                .condition(HEADER_NAME_1 + "+" + HEADER_NAME_2)
+                .build());
+
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));
         mimeMessage.addHeader(HEADER_NAME_1, HEADER_VALUE_1);
         mimeMessage.addHeader(HEADER_NAME_2, HEADER_VALUE_2);
@@ -133,7 +170,11 @@ public class HasHeaderTest {
 
     @Test
     public void matchShouldFindTheRightHeaderLineWhenUsedWithValue() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("HasHeader=" + HEADER_NAME_1 + "=" + HEADER_VALUE_2, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("HasHeader")
+                .condition(HEADER_NAME_1 + "=" + HEADER_VALUE_2)
+                .build());
+
         MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));
         mimeMessage.addHeader(HEADER_NAME_1, HEADER_VALUE_1);
         mimeMessage.addHeader(HEADER_NAME_1, HEADER_VALUE_2);

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeTest.java
index c5776b6..5bd2b6a 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeTest.java
@@ -36,8 +36,8 @@ public class HasMailAttributeTest extends AbstractHasMailAttributeTest {
         return MAIL_ATTRIBUTE_NAME;
     }
 
-    protected String getConfigOption() {
-        return "HasMailAttribute=";
+    protected String getMatcherName() {
+        return "HasMailAttribute";
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
index 71e4e5b..83e578c 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueRegexTest.java
@@ -102,7 +102,7 @@ public class HasMailAttributeWithValueRegexTest extends
         }
     }
 
-    protected String getConfigOption() {
-        return "HasMailAttributeWithValueRegex=";
+    protected String getMatcherName() {
+        return "HasMailAttributeWithValueRegex";
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueTest.java
index 88f60e7..ee373f3 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HasMailAttributeWithValueTest.java
@@ -52,7 +52,7 @@ public class HasMailAttributeWithValueTest extends AbstractHasMailAttributeTest
         assertNull(matchedRecipients);
     }
 
-    protected String getConfigOption() {
-        return "HasMailAttributeWithValue=";
+    protected String getMatcherName() {
+        return "HasMailAttributeWithValue";
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/HostIsLocalTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HostIsLocalTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HostIsLocalTest.java
index c8905dc..6582094 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HostIsLocalTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HostIsLocalTest.java
@@ -20,11 +20,11 @@
 
 package org.apache.james.transport.matchers;
 
+import static org.apache.mailet.base.MailAddressFixture.ANY_AT_JAMES;
+import static org.apache.mailet.base.MailAddressFixture.ANY_AT_JAMES2;
 import static org.apache.mailet.base.MailAddressFixture.JAMES2_APACHE_ORG;
 import static org.apache.mailet.base.MailAddressFixture.JAMES_APACHE_ORG;
-import static org.apache.mailet.base.MailAddressFixture.ANY_AT_JAMES;
 import static org.apache.mailet.base.MailAddressFixture.OTHER_AT_JAMES;
-import static org.apache.mailet.base.MailAddressFixture.ANY_AT_JAMES2;
 import static org.apache.mailet.base.MailAddressFixture.OTHER_AT_JAMES2;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
@@ -51,7 +51,11 @@ public class HostIsLocalTest {
         when(mailContext.isLocalServer(JAMES2_APACHE_ORG)).thenReturn(false);
 
         matcher = new HostIsLocal();
-        FakeMatcherConfig mci = new FakeMatcherConfig("HostIsLocal", mailContext);
+        FakeMatcherConfig mci = FakeMatcherConfig.builder()
+                .matcherName("HostIsLocal")
+                .mailetContext(mailContext)
+                .build();
+
         matcher.init(mci);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/HostIsTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HostIsTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HostIsTest.java
index af352f9..81a5eaf 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/HostIsTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/HostIsTest.java
@@ -19,10 +19,10 @@
 
 package org.apache.james.transport.matchers;
 
-import static org.apache.mailet.base.MailAddressFixture.JAMES_APACHE_ORG;
 import static org.apache.mailet.base.MailAddressFixture.ANY_AT_JAMES;
-import static org.apache.mailet.base.MailAddressFixture.OTHER_AT_JAMES;
 import static org.apache.mailet.base.MailAddressFixture.ANY_AT_JAMES2;
+import static org.apache.mailet.base.MailAddressFixture.JAMES_APACHE_ORG;
+import static org.apache.mailet.base.MailAddressFixture.OTHER_AT_JAMES;
 import static org.apache.mailet.base.MailAddressFixture.OTHER_AT_JAMES2;
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -31,7 +31,6 @@ import javax.mail.MessagingException;
 import org.apache.mailet.Mail;
 import org.apache.mailet.Matcher;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Test;
@@ -43,7 +42,11 @@ public class HostIsTest {
     @Before
     public void setUp() throws Exception {
         matcher = new HostIs();
-        FakeMatcherConfig mci = new FakeMatcherConfig("HostIs=" + JAMES_APACHE_ORG, FakeMailContext.defaultContext());
+        FakeMatcherConfig mci = FakeMatcherConfig.builder()
+                .matcherName("HostIs")
+                .condition(JAMES_APACHE_ORG)
+                .build();
+
         matcher.init(mci);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/IsSingleRecipientTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/IsSingleRecipientTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/IsSingleRecipientTest.java
index c660de9..32f342d 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/IsSingleRecipientTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/IsSingleRecipientTest.java
@@ -28,7 +28,6 @@ import javax.mail.MessagingException;
 
 import org.apache.mailet.Matcher;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Test;
@@ -40,7 +39,9 @@ public class IsSingleRecipientTest {
     @Before
     public void setUp() throws MessagingException {
         matcher = new IsSingleRecipient();
-        FakeMatcherConfig matcherConfig = new FakeMatcherConfig("IsSingleRecipient", FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfig = FakeMatcherConfig.builder()
+                .matcherName("IsSingleRecipient")
+                .build();
         matcher.init(matcherConfig);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/NESSpamCheckTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/NESSpamCheckTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/NESSpamCheckTest.java
index 5727e2e..adf387c 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/NESSpamCheckTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/NESSpamCheckTest.java
@@ -29,7 +29,6 @@ import org.apache.mailet.MailAddress;
 import org.apache.mailet.Matcher;
 import org.apache.mailet.base.RFC2822Headers;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.apache.mailet.base.test.MailUtil;
 import org.junit.Assert;
@@ -62,7 +61,10 @@ public class NESSpamCheckTest {
     private void setupMatcher() throws MessagingException {
         setupMockedMimeMessage();
         matcher = new NESSpamCheck();
-        FakeMatcherConfig mci = new FakeMatcherConfig("NESSpamCheck", FakeMailContext.defaultContext());
+        FakeMatcherConfig mci = FakeMatcherConfig.builder()
+                .matcherName("NESSpamCheck")
+                .build();
+
         matcher.init(mci);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsLocalTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsLocalTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsLocalTest.java
index 7fbb1fa..853e7e5 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsLocalTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsLocalTest.java
@@ -44,7 +44,10 @@ public class RecipientIsLocalTest {
     public void setUp() throws Exception {
         mailetContext = mock(MailetContext.class);
         testee = new RecipientIsLocal();
-        testee.init(new FakeMatcherConfig(MATCHER_NAME, mailetContext));
+        testee.init(FakeMatcherConfig.builder()
+                .matcherName(MATCHER_NAME)
+                .mailetContext(mailetContext)
+                .build());
 
         mailAddress1 = new MailAddress("mail1@domain.com");
         mailAddress2 = new MailAddress("mail2@domain.com");

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsRegexTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsRegexTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsRegexTest.java
index f261a3c..89d460e 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsRegexTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsRegexTest.java
@@ -27,7 +27,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import javax.mail.MessagingException;
 
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Rule;
@@ -48,7 +47,10 @@ public class RecipientIsRegexTest {
 
     @Test
     public void shouldMatchOneAddress() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("RecipientIsRegex=.*@.*", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIsRegex")
+                .condition(".*@.*")
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipient(ANY_AT_JAMES)
@@ -59,7 +61,10 @@ public class RecipientIsRegexTest {
 
     @Test
     public void shouldNotMatchPartially() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("RecipientIsRegex=any", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIsRegex")
+                .condition("any")
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipient(ANY_AT_JAMES)
@@ -70,7 +75,10 @@ public class RecipientIsRegexTest {
 
     @Test
     public void shouldMatchOnlyMatchingPatterns() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("RecipientIsRegex=^any@.*", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIsRegex")
+                .condition("^any@.*")
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipients(ANY_AT_JAMES, OTHER_AT_JAMES)
@@ -81,7 +89,10 @@ public class RecipientIsRegexTest {
 
     @Test
     public void shouldNotMatchNonMatchingPatterns() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("RecipientIsRegex=.*\\+", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIsRegex")
+                .condition(".*\\+")
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipients(ANY_AT_JAMES, OTHER_AT_JAMES)
@@ -93,18 +104,25 @@ public class RecipientIsRegexTest {
     @Test
     public void testRegexIsNotMatchedCauseError() throws MessagingException {
         expectedException.expect(MessagingException.class);
-        matcher.init(new FakeMatcherConfig("RecipientIsRegex=(.", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIsRegex")
+                .condition("(.")
+                .build());
     }
 
     @Test
     public void testThrowExceptionWithEmptyPattern() throws MessagingException {
         expectedException.expect(MessagingException.class);
-        matcher.init(new FakeMatcherConfig("RecipientIsRegex=", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIsRegex")
+                .build());
     }
 
     @Test
     public void testThrowExceptionWithNoCondition() throws MessagingException {
         expectedException.expect(MessagingException.class);
-        matcher.init(new FakeMatcherConfig("RecipientIsRegex", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIsRegex")
+                .build());
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsTest.java
index 774f455..b7e2e04 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/RecipientIsTest.java
@@ -26,8 +26,8 @@ import static org.apache.mailet.base.MailAddressFixture.OTHER_AT_JAMES;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import javax.mail.MessagingException;
+
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Rule;
@@ -48,7 +48,10 @@ public class RecipientIsTest {
 
     @Test
     public void shouldMatchCorrespondingAddres() throws Exception {
-        matcher.init(new FakeMatcherConfig("RecipientIs=" + ANY_AT_JAMES.toString(), FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIs")
+                .condition(ANY_AT_JAMES.toString())
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipient(ANY_AT_JAMES)
@@ -59,7 +62,10 @@ public class RecipientIsTest {
 
     @Test
     public void shouldOnlyMatchCorrespondingAddress() throws Exception {
-        matcher.init(new FakeMatcherConfig("RecipientIs=" + ANY_AT_JAMES.toString(), FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIs")
+                .condition(ANY_AT_JAMES.toString())
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipients(ANY_AT_JAMES, OTHER_AT_JAMES)
@@ -70,7 +76,10 @@ public class RecipientIsTest {
 
     @Test
     public void shouldNotMatchUnrelatedAddresses() throws Exception {
-        matcher.init(new FakeMatcherConfig("RecipientIs=" + ANY_AT_JAMES.toString(), FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIs")
+                .condition(ANY_AT_JAMES.toString())
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipients(OTHER_AT_JAMES, ANY_AT_JAMES2)
@@ -82,18 +91,25 @@ public class RecipientIsTest {
     @Test
     public void initShouldThrowOnMissingCondition() throws Exception {
         expectedException.expect(MessagingException.class);
-        matcher.init(new FakeMatcherConfig("RecipientIs", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIs")
+                .build());
     }
 
     @Test
     public void initShouldThrowOnEmptyCondition() throws Exception {
         expectedException.expect(MessagingException.class);
-        matcher.init(new FakeMatcherConfig("RecipientIs=", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIs")
+                .build());
     }
 
     @Test
     public void shouldBeAbleToMatchSeveralAddresses() throws Exception {
-        matcher.init(new FakeMatcherConfig("RecipientIs=" + ANY_AT_JAMES.toString() + ", " + ANY_AT_JAMES2.toString(), FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("RecipientIs")
+                .condition(ANY_AT_JAMES + ", " + ANY_AT_JAMES2)
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipients(ANY_AT_JAMES, OTHER_AT_JAMES, ANY_AT_JAMES2)

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/RelayLimitTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/RelayLimitTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/RelayLimitTest.java
index 42bb762..a400370 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/RelayLimitTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/RelayLimitTest.java
@@ -31,7 +31,6 @@ import javax.mail.internet.MimeMessage;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.RFC2822Headers;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Test;
@@ -47,41 +46,58 @@ public class RelayLimitTest {
         testee = new RelayLimit();
         mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()));
         mail = FakeMail.builder()
-            .recipient(ANY_AT_JAMES)
-            .mimeMessage(mimeMessage)
-            .build();
+                .recipient(ANY_AT_JAMES)
+                .mimeMessage(mimeMessage)
+                .build();
     }
 
     @Test(expected = MessagingException.class)
     public void relayLimitShouldBeANumber() throws Exception {
-        testee.init(new FakeMatcherConfig("RelayLimit=Abc", FakeMailContext.defaultContext()));
+        testee.init(FakeMatcherConfig.builder()
+                .matcherName("RelayLimit")
+                .condition("Abc")
+                .build());
     }
 
     @Test(expected = MessagingException.class)
     public void relayLimitShouldBeSpecified() throws Exception {
-        testee.init(new FakeMatcherConfig("RelayLimit=", FakeMailContext.defaultContext()));
+        testee.init(FakeMatcherConfig.builder()
+                .matcherName("RelayLimit")
+                .build());
     }
 
     @Test(expected = MessagingException.class)
     public void relayLimitShouldNotBeNull() throws Exception {
-        testee.init(new FakeMatcherConfig("RelayLimit=0", FakeMailContext.defaultContext()));
+        testee.init(FakeMatcherConfig.builder()
+                .matcherName("RelayLimit")
+                .condition("0")
+                .build());
     }
 
     @Test(expected = MessagingException.class)
-    public void relayLimitShouldNotBeEqualToZero() throws Exception {
-        testee.init(new FakeMatcherConfig("RelayLimit=-1", FakeMailContext.defaultContext()));
+    public void relayLimitShouldThrowWhenConditionLessThanZero() throws Exception {
+        testee.init(FakeMatcherConfig.builder()
+                .matcherName("RelayLimit")
+                .condition("-1")
+                .build());
     }
-
     @Test
-    public void matchShouldReturnNullWhenNoReceivedHeader() throws Exception {
-        testee.init(new FakeMatcherConfig("RelayLimit=2", FakeMailContext.defaultContext()));
+    public void shouldNotMatchWhenNoReceivedHeader() throws Exception {
+        testee.init(FakeMatcherConfig.builder()
+                .matcherName("RelayLimit")
+                .condition("2")
+                .build());
 
         assertThat(testee.match(mail)).isNull();
     }
 
+
     @Test
-    public void matchShouldReturnNullWhenNotEnoughReceivedHeader() throws Exception {
-        testee.init(new FakeMatcherConfig("RelayLimit=2", FakeMailContext.defaultContext()));
+    public void shouldNotMatchWhenNotEnoughReceivedHeader() throws Exception {
+        testee.init(FakeMatcherConfig.builder()
+                .matcherName("RelayLimit")
+                .condition("2")
+                .build());
 
         mimeMessage.addHeader(RFC2822Headers.RECEIVED, "any");
 
@@ -89,8 +105,11 @@ public class RelayLimitTest {
     }
 
     @Test
-    public void matchShouldReturnAddressWhenEqualToLimit() throws Exception {
-        testee.init(new FakeMatcherConfig("RelayLimit=2", FakeMailContext.defaultContext()));
+    public void shouldMatchWhenEqualToLimit() throws Exception {
+        testee.init(FakeMatcherConfig.builder()
+                .matcherName("RelayLimit")
+                .condition("2")
+                .build());
 
         mimeMessage.addHeader(RFC2822Headers.RECEIVED, "any");
         mimeMessage.addHeader(RFC2822Headers.RECEIVED, "any");
@@ -99,8 +118,11 @@ public class RelayLimitTest {
     }
 
     @Test
-    public void matchShouldReturnAddressWhenOverLimit() throws Exception {
-        testee.init(new FakeMatcherConfig("RelayLimit=2", FakeMailContext.defaultContext()));
+    public void shouldMatchWhenWhenOverLimit() throws Exception {
+        testee.init(FakeMatcherConfig.builder()
+                .matcherName("RelayLimit")
+                .condition("2")
+                .build());
 
         mimeMessage.addHeader(RFC2822Headers.RECEIVED, "any");
         mimeMessage.addHeader(RFC2822Headers.RECEIVED, "any");

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPAuthSuccessfulTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPAuthSuccessfulTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPAuthSuccessfulTest.java
index 83df994..5bd45eb 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPAuthSuccessfulTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPAuthSuccessfulTest.java
@@ -32,7 +32,7 @@ public class SMTPAuthSuccessfulTest extends AbstractHasMailAttributeTest {
         return new SMTPAuthSuccessful();
     }
 
-    protected String getConfigOption() {   
+    protected String getMatcherName() {
         return "SMTPAuthSuccessful";
     }
     

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPAuthUserIsTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPAuthUserIsTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPAuthUserIsTest.java
index 4177f23..c7613b4 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPAuthUserIsTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPAuthUserIsTest.java
@@ -38,8 +38,8 @@ public class SMTPAuthUserIsTest extends AbstractHasMailAttributeTest {
         return new SMTPAuthUserIs();
     }
 
-    protected String getConfigOption() {   
-        return "SMTPAuthUserIs=";
+    protected String getMatcherName() {
+        return "SMTPAuthUserIs";
     }
     
     protected void init() {

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPIsAuthNetworkTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPIsAuthNetworkTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPIsAuthNetworkTest.java
index b4ecee6..282879c 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPIsAuthNetworkTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SMTPIsAuthNetworkTest.java
@@ -27,7 +27,6 @@ import javax.mail.MessagingException;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.Matcher;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.apache.mailet.base.test.MailUtil;
 import org.junit.Assert;
@@ -55,8 +54,10 @@ public class SMTPIsAuthNetworkTest {
 
     private void setupMatcher() throws MessagingException {
         matcher = new SMTPIsAuthNetwork();
-        FakeMatcherConfig mci = new FakeMatcherConfig("SMTPIsAuthNetwork",
-                FakeMailContext.defaultContext());
+        FakeMatcherConfig mci = FakeMatcherConfig.builder()
+                .matcherName("SMTPIsAuthNetwork")
+                .build();
+
         matcher.init(mci);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderHostIsLocalTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderHostIsLocalTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderHostIsLocalTest.java
index e52fc4c..d61b52a 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderHostIsLocalTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderHostIsLocalTest.java
@@ -52,7 +52,11 @@ public class SenderHostIsLocalTest {
         when(mailContext.isLocalServer(JAMES2_APACHE_ORG)).thenReturn(false);
         
         matcher = new SenderHostIsLocal();
-        FakeMatcherConfig mci= new FakeMatcherConfig("SenderHostIsLocal", mailContext);
+        FakeMatcherConfig mci = FakeMatcherConfig.builder()
+                .matcherName("SenderHostIsLocal")
+                .mailetContext(mailContext)
+                .build();
+        
         matcher.init(mci);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsLocalTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsLocalTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsLocalTest.java
index a3ebb91..87b81a7 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsLocalTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsLocalTest.java
@@ -51,7 +51,11 @@ public class SenderIsLocalTest {
         when(mailContext.isLocalEmail(ANY_AT_JAMES2)).thenReturn(false);
         
         matcher = new SenderIsLocal();
-        FakeMatcherConfig mci = new FakeMatcherConfig("SenderIsLocal", mailContext);
+        FakeMatcherConfig mci = FakeMatcherConfig.builder()
+                .matcherName("SenderIsLocal")
+                .mailetContext(mailContext)
+                .build();
+
         matcher.init(mci);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsNullTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsNullTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsNullTest.java
index 0c3845b..ed3a77e 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsNullTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsNullTest.java
@@ -25,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Rule;
@@ -42,7 +41,9 @@ public class SenderIsNullTest {
     @Before
     public void setUp() throws Exception {
         matcher = new SenderIsNull();
-        matcher.init(new FakeMatcherConfig("SenderIsNull", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIsNull")
+                .build());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsRegexTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsRegexTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsRegexTest.java
index aeddff2..2538914 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsRegexTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsRegexTest.java
@@ -26,7 +26,6 @@ import javax.mail.MessagingException;
 
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Rule;
@@ -50,7 +49,10 @@ public class SenderIsRegexTest {
 
     @Test
     public void shouldMatchOnMatchingPattern() throws Exception {
-        matcher.init(new FakeMatcherConfig("SenderIsRegex=.*@.*", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIsRegex")
+                .condition(".*@.*")
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .sender(new MailAddress(SENDER_NAME))
@@ -62,7 +64,10 @@ public class SenderIsRegexTest {
 
     @Test
     public void shouldNotMatchSubParts() throws Exception {
-        matcher.init(new FakeMatcherConfig("SenderIsRegex=test", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIsRegex")
+                .condition("test")
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .sender(new MailAddress(SENDER_NAME))
@@ -74,7 +79,10 @@ public class SenderIsRegexTest {
 
     @Test
     public void shouldNotMatchWhenNullSender() throws Exception {
-        matcher.init(new FakeMatcherConfig("SenderIsRegex=.*@.*", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIsRegex")
+                .condition(".*@.*")
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipient(recipient)
@@ -85,7 +93,10 @@ public class SenderIsRegexTest {
 
     @Test
     public void shouldNotMatchOnNonMatchingPattern() throws Exception {
-        matcher.init(new FakeMatcherConfig("SenderIsRegex=^\\.", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIsRegex")
+                .condition("^\\.")
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .sender(new MailAddress(SENDER_NAME))
@@ -98,18 +109,25 @@ public class SenderIsRegexTest {
     @Test
     public void initShouldThrowWhenEmptyCondition() throws MessagingException {
         expectedException.expect(MessagingException.class);
-        matcher.init(new FakeMatcherConfig("SenderIsRegex=", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIsRegex")
+                .build());
     }
 
     @Test
     public void initShouldThrowWhenNoConditions() throws MessagingException {
         expectedException.expect(MessagingException.class);
-        matcher.init(new FakeMatcherConfig("SenderIsRegex", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIsRegex")
+                .build());
     }
 
     @Test
     public void initShouldThrowWhenInvalidPattern() throws MessagingException {
         expectedException.expect(MessagingException.class);
-        matcher.init(new FakeMatcherConfig("SenderIsRegex=(.", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIsRegex")
+                .condition("(.")
+                .build());
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsTest.java
index 7b2297e..234e7ad 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SenderIsTest.java
@@ -26,7 +26,6 @@ import javax.mail.MessagingException;
 
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Rule;
@@ -51,7 +50,10 @@ public class SenderIsTest {
 
     @Test
     public void shouldMatchWhenGoodSender() throws Exception {
-        matcher.init(new FakeMatcherConfig("SenderIs=" + SENDER_NAME, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIs")
+                .condition(SENDER_NAME)
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipient(recipient)
@@ -63,7 +65,10 @@ public class SenderIsTest {
 
     @Test
     public void shouldNotMatchWhenWrongSender() throws Exception {
-        matcher.init(new FakeMatcherConfig("SenderIs=" + SENDER_NAME, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIs")
+                .condition(SENDER_NAME)
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipient(recipient)
@@ -75,7 +80,10 @@ public class SenderIsTest {
 
     @Test
     public void shouldNotMatchWhenNullSender() throws Exception {
-        matcher.init(new FakeMatcherConfig("SenderIs=" + SENDER_NAME, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIs")
+                .condition(SENDER_NAME)
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipient(recipient)
@@ -87,7 +95,10 @@ public class SenderIsTest {
     @Test
     public void senderIsShouldBeConfigurableWithSeveralAddresses() throws Exception {
         String mailAddress = "any@apache.org";
-        matcher.init(new FakeMatcherConfig("SenderIs=" + mailAddress + ", " + SENDER_NAME, FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIs")
+                .condition(mailAddress + ", " + SENDER_NAME)
+                .build());
 
         assertThat(matcher.getSenders()).containsExactly(new MailAddress(mailAddress), new MailAddress(SENDER_NAME));
     }
@@ -95,12 +106,16 @@ public class SenderIsTest {
     @Test
     public void senderIsShouldThrowWhenNoAddressesPassedByConfiguration() throws Exception {
         expectedException.expect(MessagingException.class);
-        matcher.init(new FakeMatcherConfig("SenderIs=", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIs")
+                .build());
     }
 
     @Test
     public void senderIsShouldThrowWhenNoConfiguration() throws Exception {
         expectedException.expect(MessagingException.class);
-        matcher.init(new FakeMatcherConfig("SenderIs", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("SenderIs")
+                .build());
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/SizeGreaterThanTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SizeGreaterThanTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SizeGreaterThanTest.java
index 655112c..9bfca72 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SizeGreaterThanTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SizeGreaterThanTest.java
@@ -27,7 +27,6 @@ import javax.mail.MessagingException;
 import org.apache.mailet.Mail;
 import org.apache.mailet.Matcher;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Rule;
@@ -53,7 +52,11 @@ public class SizeGreaterThanTest {
             .recipient(ANY_AT_JAMES)
             .build();
 
-        FakeMatcherConfig matcherConfiguration = new FakeMatcherConfig("SizeGreaterThan=1m", FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfiguration = FakeMatcherConfig.builder()
+                .matcherName("SizeGreaterThan")
+                .condition("1m")
+                .build();
+
         matcher.init(matcherConfiguration);
 
         assertThat(matcher.match(mail)).containsExactly(ANY_AT_JAMES);
@@ -66,7 +69,11 @@ public class SizeGreaterThanTest {
             .recipient(ANY_AT_JAMES)
             .build();
 
-        FakeMatcherConfig matcherConfiguration = new FakeMatcherConfig("SizeGreaterThan=1m", FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfiguration = FakeMatcherConfig.builder()
+                .matcherName("SizeGreaterThan")
+                .condition("1m")
+                .build();
+
         matcher.init(matcherConfiguration);
 
         assertThat(matcher.match(mail)).isNull();
@@ -79,7 +86,11 @@ public class SizeGreaterThanTest {
             .recipient(ANY_AT_JAMES)
             .build();
 
-        FakeMatcherConfig matcherConfiguration = new FakeMatcherConfig("SizeGreaterThan=1k", FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfiguration = FakeMatcherConfig.builder()
+                .matcherName("SizeGreaterThan")
+                .condition("1k")
+                .build();
+
         matcher.init(matcherConfiguration);
 
         assertThat(matcher.match(mail)).isNull();
@@ -92,7 +103,11 @@ public class SizeGreaterThanTest {
             .recipient(ANY_AT_JAMES)
             .build();
 
-        FakeMatcherConfig matcherConfiguration = new FakeMatcherConfig("SizeGreaterThan=1k", FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfiguration = FakeMatcherConfig.builder()
+                .matcherName("SizeGreaterThan")
+                .condition("1k")
+                .build();
+
         matcher.init(matcherConfiguration);
 
         assertThat(matcher.match(mail)).containsExactly(ANY_AT_JAMES);
@@ -105,7 +120,11 @@ public class SizeGreaterThanTest {
             .recipient(ANY_AT_JAMES)
             .build();
 
-        FakeMatcherConfig matcherConfiguration = new FakeMatcherConfig("SizeGreaterThan=4", FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfiguration = FakeMatcherConfig.builder()
+                .matcherName("SizeGreaterThan")
+                .condition("4")
+                .build();
+
         matcher.init(matcherConfiguration);
 
         assertThat(matcher.match(mail)).isNull();
@@ -118,7 +137,11 @@ public class SizeGreaterThanTest {
             .recipient(ANY_AT_JAMES)
             .build();
 
-        FakeMatcherConfig matcherConfiguration = new FakeMatcherConfig("SizeGreaterThan=4", FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfiguration = FakeMatcherConfig.builder()
+                .matcherName("SizeGreaterThan")
+                .condition("4")
+                .build();
+
         matcher.init(matcherConfiguration);
 
         assertThat(matcher.match(mail)).containsExactly(ANY_AT_JAMES);
@@ -127,19 +150,31 @@ public class SizeGreaterThanTest {
     @Test
     public void initShouldThrowOnInvalidUnits() throws Exception {
         expectedException.expect(MessagingException.class);
-        FakeMatcherConfig matcherConfiguration = new FakeMatcherConfig("SizeGreaterThan=1mb", FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfiguration = FakeMatcherConfig.builder()
+                .matcherName("SizeGreaterThan")
+                .condition("1mb")
+                .build();
+
         matcher.init(matcherConfiguration);
     }
 
     @Test(expected = MessagingException.class)
     public void initShouldThrowOnNullSize() throws Exception {
-        FakeMatcherConfig matcherConfiguration = new FakeMatcherConfig("SizeGreaterThan=0", FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfiguration = FakeMatcherConfig.builder()
+                .matcherName("SizeGreaterThan")
+                .condition("0")
+                .build();
+
         matcher.init(matcherConfiguration);
     }
 
     @Test(expected = MessagingException.class)
     public void initShouldThrowOnNegativeSize() throws Exception {
-        FakeMatcherConfig matcherConfiguration = new FakeMatcherConfig("SizeGreaterThan=-1", FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfiguration = FakeMatcherConfig.builder()
+                .matcherName("SizeGreaterThan")
+                .condition("-1")
+                .build();
+
         matcher.init(matcherConfiguration);
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/SubjectIsTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SubjectIsTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SubjectIsTest.java
index 9e08582..fe388c2 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SubjectIsTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SubjectIsTest.java
@@ -27,7 +27,6 @@ import javax.mail.internet.AddressException;
 
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.apache.mailet.base.test.MailUtil;
 import org.junit.Before;
@@ -50,9 +49,12 @@ public class SubjectIsTest {
                 .mimeMessage(MailUtil.createMimeMessageWithSubject("test"))
                 .recipients(roger)
                 .build();
-        
-        FakeMatcherConfig mailetConfig = new FakeMatcherConfig("SubjectIs=test", FakeMailContext.defaultContext());
-        
+
+        FakeMatcherConfig mailetConfig = FakeMatcherConfig.builder()
+                .matcherName("SubjectIs")
+                .condition("test")
+                .build();
+
         matcher.init(mailetConfig);
 
         assertThat(matcher.match(mail)).containsExactly(roger);
@@ -64,9 +66,12 @@ public class SubjectIsTest {
                 .mimeMessage(MailUtil.createMimeMessageWithSubject("foobar"))
                 .recipients(roger)
                 .build();
-        
-        FakeMatcherConfig mailetConfig = new FakeMatcherConfig("SubjectIs=foo", FakeMailContext.defaultContext());
-        
+
+        FakeMatcherConfig mailetConfig = FakeMatcherConfig.builder()
+                .matcherName("SubjectIs")
+                .condition("foo")
+                .build();
+
         matcher.init(mailetConfig);
 
         assertThat(matcher.match(mail)).isNull();
@@ -79,7 +84,10 @@ public class SubjectIsTest {
                 .recipients(roger)
                 .build();
         
-        FakeMatcherConfig mailetConfig = new FakeMatcherConfig("SubjectIs=foo", FakeMailContext.defaultContext());
+        FakeMatcherConfig mailetConfig = FakeMatcherConfig.builder()
+                .matcherName("SubjectIs")
+                .condition("foo")
+                .build();
         
         matcher.init(mailetConfig);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/SubjectStartsWithTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SubjectStartsWithTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SubjectStartsWithTest.java
index 673d6d4..dd7c28c 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/SubjectStartsWithTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/SubjectStartsWithTest.java
@@ -27,7 +27,6 @@ import javax.mail.internet.AddressException;
 
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.apache.mailet.base.test.MailUtil;
 import org.junit.Before;
@@ -51,8 +50,11 @@ public class SubjectStartsWithTest {
                 .mimeMessage(MailUtil.createMimeMessageWithSubject("testSubject"))
                 .build();
         
-        FakeMatcherConfig mailetConfig = new FakeMatcherConfig("SubjectIs=test", FakeMailContext.defaultContext());
-        
+        FakeMatcherConfig mailetConfig = FakeMatcherConfig.builder()
+                .matcherName("SubjectStartsWith")
+                .condition("test")
+                .build();
+
         matcher.init(mailetConfig);
 
         assertThat(matcher.match(mail)).containsExactly(roger);
@@ -65,8 +67,11 @@ public class SubjectStartsWithTest {
                 .mimeMessage(MailUtil.createMimeMessageWithSubject("foobar"))
                 .build();
         
-        FakeMatcherConfig mailetConfig = new FakeMatcherConfig("SubjectIs=test", FakeMailContext.defaultContext());
-        
+        FakeMatcherConfig mailetConfig = FakeMatcherConfig.builder()
+                .matcherName("SubjectStartsWith")
+                .condition("test")
+                .build();
+
         matcher.init(mailetConfig);
 
         assertThat(matcher.match(mail)).isNull();
@@ -80,7 +85,10 @@ public class SubjectStartsWithTest {
                 .mimeMessage(MailUtil.createMimeMessageWithSubject(null))
                 .build();
         
-        FakeMatcherConfig mailetConfig = new FakeMatcherConfig("SubjectIs=test", FakeMailContext.defaultContext());
+        FakeMatcherConfig mailetConfig = FakeMatcherConfig.builder()
+                .matcherName("SubjectStartsWith")
+                .condition("test")
+                .build();
         
         matcher.init(mailetConfig);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/mailet/standard/src/test/java/org/apache/james/transport/matchers/UserIsTest.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/test/java/org/apache/james/transport/matchers/UserIsTest.java b/mailet/standard/src/test/java/org/apache/james/transport/matchers/UserIsTest.java
index faa98b4..52b8b3a 100644
--- a/mailet/standard/src/test/java/org/apache/james/transport/matchers/UserIsTest.java
+++ b/mailet/standard/src/test/java/org/apache/james/transport/matchers/UserIsTest.java
@@ -29,7 +29,6 @@ import static org.assertj.core.api.Assertions.assertThat;
 import javax.mail.MessagingException;
 
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Rule;
@@ -50,7 +49,10 @@ public class UserIsTest {
 
     @Test
     public void shouldMatchCorrespondingUser() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("UserIs=any", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("UserIs")
+                .condition("any")
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipient(ANY_AT_JAMES)
@@ -61,7 +63,10 @@ public class UserIsTest {
 
     @Test
     public void shouldMatchCorrespondingUserAccrossDomains() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("UserIs=any", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("UserIs")
+                .condition("any")
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipients(ANY_AT_JAMES, ANY_AT_JAMES2)
@@ -72,7 +77,10 @@ public class UserIsTest {
 
     @Test
     public void shouldNotMatchNonSpecifiedUsersButPreserveSpecifiedUsers() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("UserIs=any", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("UserIs")
+                .condition("any")
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipients(ANY_AT_JAMES, OTHER_AT_JAMES)
@@ -83,7 +91,10 @@ public class UserIsTest {
 
     @Test
     public void shouldNotMatchNonSpecifiedUsers() throws MessagingException {
-        matcher.init(new FakeMatcherConfig("UserIs=any", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("UserIs")
+                .condition("any")
+                .build());
 
         FakeMail fakeMail = FakeMail.builder()
             .recipients(OTHER_AT_JAMES)
@@ -95,12 +106,16 @@ public class UserIsTest {
     @Test
     public void initShouldThrowOnMissingCondition() throws Exception {
         expectedException.expect(MessagingException.class);
-        matcher.init(new FakeMatcherConfig("UserIs", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("UserIs")
+                .build());
     }
 
     @Test
     public void initShouldThrowOnEmptyCondition() throws Exception {
         expectedException.expect(MessagingException.class);
-        matcher.init(new FakeMatcherConfig("UserIs=", FakeMailContext.defaultContext()));
+        matcher.init(FakeMatcherConfig.builder()
+                .matcherName("UserIs")
+                .build());
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java
index 4fd7ee7..698960c 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java
@@ -33,7 +33,6 @@ import org.apache.james.dnsservice.api.mock.MockDNSService;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Test;
 
@@ -68,8 +67,11 @@ public class InSpammerBlacklistTest {
     private void setupMatcher(String blacklist) throws MessagingException {
         matcher = new InSpammerBlacklist();
         matcher.setDNSService(setUpDNSServer());
-        FakeMailContext context = FakeMailContext.defaultContext();
-        FakeMatcherConfig mci = new FakeMatcherConfig("InSpammerBlacklist=" + blacklist, context);
+        FakeMatcherConfig mci = FakeMatcherConfig.builder()
+                .matcherName("InSpammerBlacklist")
+                .condition(blacklist)
+                .build();
+
         matcher.init(mci);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java
index 20dfd17..fa8521d 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java
@@ -29,7 +29,6 @@ import javax.mail.MessagingException;
 import org.apache.james.dnsservice.api.mock.MockDNSService;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Test;
@@ -47,7 +46,11 @@ public class RemoteAddrInNetworkTest {
                 return InetAddress.getByName(host);
             }
         };
-        FakeMatcherConfig matcherConfig = new FakeMatcherConfig("AllowedNetworkIs=192.168.200.0/24", FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfig = FakeMatcherConfig.builder()
+                .matcherName("AllowedNetworkIs")
+                .condition("192.168.200.0/24")
+                .build();
+
         matcher = new RemoteAddrInNetwork();
         matcher.setDNSService(dnsServer);
         matcher.init(matcherConfig);
@@ -80,7 +83,10 @@ public class RemoteAddrInNetworkTest {
 
     @Test
     public void shouldNotMatchWhenNoCondition() throws MessagingException {
-        FakeMatcherConfig matcherConfig = new FakeMatcherConfig("", FakeMailContext.defaultContext());
+        FakeMatcherConfig matcherConfig = FakeMatcherConfig.builder()
+                .matcherName("")
+                .build();
+
         RemoteAddrInNetwork testee = new RemoteAddrInNetwork();
         testee.init(matcherConfig);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/c6855a29/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java
index fe7f50e..374c97a 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java
@@ -29,7 +29,6 @@ import javax.mail.MessagingException;
 import org.apache.james.dnsservice.api.mock.MockDNSService;
 import org.apache.mailet.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
-import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.Before;
 import org.junit.Test;
@@ -48,7 +47,11 @@ public class RemoteAddrNotInNetworkTest {
                 return InetAddress.getByName(host);
             }
         };
-        matcherConfig = new FakeMatcherConfig("AllowedNetworkIs=192.168.200.0/24", FakeMailContext.defaultContext());
+        matcherConfig = FakeMatcherConfig.builder()
+                .matcherName("AllowedNetworkIs")
+                .condition("192.168.200.0/24")
+                .build();
+
         matcher = new RemoteAddrNotInNetwork();
         matcher.setDNSService(dnsServer);
         matcher.init(matcherConfig);
@@ -81,7 +84,10 @@ public class RemoteAddrNotInNetworkTest {
 
     @Test
     public void shouldMatchWhenNoCondition() throws MessagingException {
-        matcherConfig = new FakeMatcherConfig("", FakeMailContext.defaultContext());
+        matcherConfig = FakeMatcherConfig.builder()
+                .matcherName("")
+                .build();
+
         matcher = new RemoteAddrNotInNetwork();
         matcher.init(matcherConfig);
 


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