james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [02/22] james-project git commit: MAILBOX-350 Review MailboxManagerTest: Rely on AssertJ soft assertions
Date Wed, 21 Nov 2018 10:07:12 GMT
MAILBOX-350 Review MailboxManagerTest: Rely on AssertJ soft assertions


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

Branch: refs/heads/master
Commit: 7c19e19f6055a1b956152dd7b20d7cedafd2b15f
Parents: 315e24e
Author: Benoit Tellier <btellier@linagora.com>
Authored: Tue Nov 20 13:19:29 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Wed Nov 21 16:40:18 2018 +0700

----------------------------------------------------------------------
 .../james/mailbox/MailboxManagerTest.java       | 45 ++++++++++----------
 1 file changed, 22 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/7c19e19f/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
index 76c7342..17bdc33 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
@@ -21,6 +21,7 @@ package org.apache.james.mailbox;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.assertj.core.api.SoftAssertions.assertSoftly;
 
 import java.nio.charset.StandardCharsets;
 import java.time.Duration;
@@ -50,9 +51,7 @@ import org.apache.james.mailbox.model.search.MailboxQuery;
 import org.apache.james.mailbox.util.EventCollector;
 import org.apache.james.mime4j.dom.Message;
 import org.apache.james.util.concurrency.ConcurrentTestRunner;
-import org.assertj.core.api.JUnitSoftAssertions;
 import org.junit.Assume;
-import org.junit.Rule;
 import org.junit.Test;
 
 import com.google.common.base.Strings;
@@ -87,9 +86,6 @@ public abstract class MailboxManagerTest {
 
     private static final List<MailboxAnnotation> ANNOTATIONS = ImmutableList.of(PRIVATE_ANNOTATION,
SHARED_ANNOTATION);
 
-    @Rule
-    public JUnitSoftAssertions softly = new JUnitSoftAssertions();
-
     private MailboxManager mailboxManager;
     private MailboxSession session;
     private Message.Builder message;
@@ -893,24 +889,27 @@ public abstract class MailboxManagerTest {
         MessageManager.MetaData metaData = mailboxManager.getMailbox(inbox1, session2)
             .getMetaData(resetRecent, session2, MessageManager.MetaData.FetchGroup.UNSEEN_COUNT);
 
-        softly.assertThat(metaData)
-            .extracting(MessageManager.MetaData::getHighestModSeq)
-            .contains(0L);
-        softly.assertThat(metaData)
-            .extracting(MessageManager.MetaData::getUidNext)
-            .contains(MessageUid.MIN_VALUE);
-        softly.assertThat(metaData)
-            .extracting(MessageManager.MetaData::getMessageCount)
-            .contains(0L);
-        softly.assertThat(metaData)
-            .extracting(MessageManager.MetaData::getUnseenCount)
-            .contains(0L);
-        softly.assertThat(metaData)
-            .extracting(MessageManager.MetaData::getRecent)
-            .contains(ImmutableList.of());
-        softly.assertThat(metaData)
-            .extracting(MessageManager.MetaData::getPermanentFlags)
-            .contains(new Flags());
+        assertSoftly(
+            softly -> {
+                softly.assertThat(metaData)
+                    .extracting(MessageManager.MetaData::getHighestModSeq)
+                    .contains(0L);
+                softly.assertThat(metaData)
+                    .extracting(MessageManager.MetaData::getUidNext)
+                    .contains(MessageUid.MIN_VALUE);
+                softly.assertThat(metaData)
+                    .extracting(MessageManager.MetaData::getMessageCount)
+                    .contains(0L);
+                softly.assertThat(metaData)
+                    .extracting(MessageManager.MetaData::getUnseenCount)
+                    .contains(0L);
+                softly.assertThat(metaData)
+                    .extracting(MessageManager.MetaData::getRecent)
+                    .contains(ImmutableList.of());
+                softly.assertThat(metaData)
+                    .extracting(MessageManager.MetaData::getPermanentFlags)
+                    .contains(new Flags());
+            });
     }
 
     @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