james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [13/17] james-project git commit: MAILET-124 OrTest should not be sensitive to address order
Date Thu, 15 Sep 2016 10:08:54 GMT
MAILET-124 OrTest should not be sensitive to address order


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

Branch: refs/heads/master
Commit: c8648a199ded879e793b41c45cf5b4197ca473c2
Parents: a78c854
Author: Benoit Tellier <btellier@linagora.com>
Authored: Thu Sep 8 14:58:13 2016 +0200
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Thu Sep 15 12:06:33 2016 +0200

----------------------------------------------------------------------
 .../james/mailetcontainer/impl/matchers/Or.java |  2 +-
 .../mailetcontainer/impl/matchers/OrTest.java   | 28 ++++++++++----------
 2 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/c8648a19/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java
b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java
index 5d4f3c1..b375d4c 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java
@@ -50,7 +50,7 @@ public class Or extends GenericCompositeMatcher {
                 break;
             }
         }
-        return ImmutableSet.copyOf(result);
+        return result;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c8648a19/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/OrTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/OrTest.java
b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/OrTest.java
index d71ee19..94fb41c 100644
--- a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/OrTest.java
+++ b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/matchers/OrTest.java
@@ -19,10 +19,10 @@
 
 package org.apache.james.mailetcontainer.impl.matchers;
 
-import static org.apache.mailet.base.MailAddressFixture.MAIL_ADDRESS_1;
-import static org.apache.mailet.base.MailAddressFixture.MAIL_ADDRESS_2;
-import static org.apache.mailet.base.MailAddressFixture.MAIL_ADDRESS_3_OTHER_DOMAIN;
-import static org.apache.mailet.base.MailAddressFixture.MAIL_ADDRESS_4_OTHER_DOMAIN;
+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;
 import static org.mockito.Mockito.when;
@@ -50,7 +50,7 @@ public class OrTest {
 
         testee = new Or();
 
-        mail = FakeMail.builder().recipients(MAIL_ADDRESS_1, MAIL_ADDRESS_2, MAIL_ADDRESS_3_OTHER_DOMAIN,
MAIL_ADDRESS_4_OTHER_DOMAIN).build();
+        mail = FakeMail.builder().recipients(ANY_AT_JAMES, OTHER_AT_JAMES, ANY_AT_JAMES2,
OTHER_AT_JAMES2).build();
     }
 
     @Test
@@ -60,43 +60,43 @@ public class OrTest {
 
     @Test
     public void shouldReturnMatchResultWhenOnlyOneMatcher() throws Exception {
-        when(matcher1.match(mail)).thenReturn(ImmutableList.of(MAIL_ADDRESS_1, MAIL_ADDRESS_3_OTHER_DOMAIN));
+        when(matcher1.match(mail)).thenReturn(ImmutableList.of(ANY_AT_JAMES, ANY_AT_JAMES2));
 
         testee.add(matcher1);
 
-        assertThat(testee.match(mail)).containsExactly(MAIL_ADDRESS_1, MAIL_ADDRESS_3_OTHER_DOMAIN);
+        assertThat(testee.match(mail)).containsOnly(ANY_AT_JAMES, ANY_AT_JAMES2);
     }
 
     @Test
     public void shouldReturnUnionWhenTwoMatchers() throws Exception {
-        when(matcher1.match(mail)).thenReturn(ImmutableList.of(MAIL_ADDRESS_1, MAIL_ADDRESS_3_OTHER_DOMAIN));
-        when(matcher2.match(mail)).thenReturn(ImmutableList.of(MAIL_ADDRESS_1, MAIL_ADDRESS_2));
+        when(matcher1.match(mail)).thenReturn(ImmutableList.of(ANY_AT_JAMES, ANY_AT_JAMES2));
+        when(matcher2.match(mail)).thenReturn(ImmutableList.of(ANY_AT_JAMES, OTHER_AT_JAMES));
 
         testee.add(matcher1);
         testee.add(matcher2);
 
-        assertThat(testee.match(mail)).containsExactly(MAIL_ADDRESS_1, MAIL_ADDRESS_3_OTHER_DOMAIN,
MAIL_ADDRESS_2);
+        assertThat(testee.match(mail)).containsOnly(ANY_AT_JAMES, ANY_AT_JAMES2, OTHER_AT_JAMES);
     }
 
     @Test
     public void shouldAcceptEmptyResults() throws Exception {
-        when(matcher1.match(mail)).thenReturn(ImmutableList.of(MAIL_ADDRESS_1, MAIL_ADDRESS_3_OTHER_DOMAIN));
+        when(matcher1.match(mail)).thenReturn(ImmutableList.of(ANY_AT_JAMES, ANY_AT_JAMES2));
         when(matcher2.match(mail)).thenReturn(ImmutableList.<MailAddress>of());
 
         testee.add(matcher1);
         testee.add(matcher2);
 
-        assertThat(testee.match(mail)).containsExactly(MAIL_ADDRESS_1, MAIL_ADDRESS_3_OTHER_DOMAIN);
+        assertThat(testee.match(mail)).containsOnly(ANY_AT_JAMES, ANY_AT_JAMES2);
     }
 
     @Test
     public void shouldAcceptNullResults() throws Exception {
-        when(matcher1.match(mail)).thenReturn(ImmutableList.of(MAIL_ADDRESS_1, MAIL_ADDRESS_3_OTHER_DOMAIN));
+        when(matcher1.match(mail)).thenReturn(ImmutableList.of(ANY_AT_JAMES, ANY_AT_JAMES2));
         when(matcher2.match(mail)).thenReturn(null);
 
         testee.add(matcher1);
         testee.add(matcher2);
 
-        assertThat(testee.match(mail)).containsExactly(MAIL_ADDRESS_1, MAIL_ADDRESS_3_OTHER_DOMAIN);
+        assertThat(testee.match(mail)).containsOnly(ANY_AT_JAMES, ANY_AT_JAMES2);
     }
 }


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