james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [08/12] james-project git commit: JAMES-2161 KeywordsTest: get rid of ExpectedException
Date Tue, 27 Nov 2018 02:06:35 GMT
JAMES-2161 KeywordsTest: get rid of ExpectedException


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

Branch: refs/heads/master
Commit: 6a0715dea541973f8cdc99f25dd09418093617c9
Parents: e9f4865
Author: Benoit Tellier <btellier@linagora.com>
Authored: Fri Nov 23 10:37:59 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Tue Nov 27 09:01:54 2018 +0700

----------------------------------------------------------------------
 .../apache/james/jmap/model/KeywordsTest.java   | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/6a0715de/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/KeywordsTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/KeywordsTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/KeywordsTest.java
index e48b9cf..0c5162d 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/KeywordsTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/KeywordsTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.jmap.model;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.Map;
 
@@ -27,9 +28,7 @@ import javax.mail.Flags;
 import javax.mail.Flags.Flag;
 
 import org.apache.james.mailbox.FlagsBuilder;
-import org.junit.Rule;
 import org.junit.Test;
-import org.junit.rules.ExpectedException;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
@@ -39,8 +38,6 @@ import nl.jqno.equalsverifier.EqualsVerifier;
 
 public class KeywordsTest {
     public static final String ANY_KEYWORD = "AnyKeyword";
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
 
     @Test
     public void shouldRespectBeanContract() {
@@ -49,10 +46,9 @@ public class KeywordsTest {
 
     @Test
     public void fromMapShouldThrowWhenWrongKeywordValue() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        Keywords.lenientFactory()
-            .fromMap(ImmutableMap.of(ANY_KEYWORD, false));
+        assertThatThrownBy(() -> Keywords.lenientFactory()
+            .fromMap(ImmutableMap.of(ANY_KEYWORD, false)))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
@@ -141,10 +137,10 @@ public class KeywordsTest {
 
     @Test
     public void throwWhenUnsupportedKeywordShouldThrowWhenHaveUnsupportedKeywords() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        Keywords.strictFactory()
-            .fromSet(ImmutableSet.of(Keyword.DRAFT, Keyword.DELETED));
+        assertThatThrownBy(() ->
+            Keywords.strictFactory()
+                .fromSet(ImmutableSet.of(Keyword.DRAFT, Keyword.DELETED)))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test


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