james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [02/10] james-project git commit: MAILBOX-351 ReIndexerImpl test: use Assertj statisfies
Date Thu, 29 Nov 2018 03:53:16 GMT
MAILBOX-351 ReIndexerImpl test: use Assertj statisfies


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

Branch: refs/heads/master
Commit: 9b430511cd11a16873caf1c51530084f196d200d
Parents: 3957215
Author: Benoit Tellier <btellier@linagora.com>
Authored: Wed Nov 28 15:44:34 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Thu Nov 29 10:52:45 2018 +0700

----------------------------------------------------------------------
 .../tools/indexer/ReIndexerImplTest.java        | 56 ++++++++++++--------
 1 file changed, 34 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/9b430511/mailbox/tools/indexer/src/test/java/org/apache/mailbox/tools/indexer/ReIndexerImplTest.java
----------------------------------------------------------------------
diff --git a/mailbox/tools/indexer/src/test/java/org/apache/mailbox/tools/indexer/ReIndexerImplTest.java
b/mailbox/tools/indexer/src/test/java/org/apache/mailbox/tools/indexer/ReIndexerImplTest.java
index 80bcecd..3e0661f 100644
--- a/mailbox/tools/indexer/src/test/java/org/apache/mailbox/tools/indexer/ReIndexerImplTest.java
+++ b/mailbox/tools/indexer/src/test/java/org/apache/mailbox/tools/indexer/ReIndexerImplTest.java
@@ -85,10 +85,12 @@ public class ReIndexerImplTest {
         verify(messageSearchIndex).add(any(MailboxSession.class), mailboxCaptor2.capture(),
messageCaptor.capture());
         verifyNoMoreInteractions(messageSearchIndex);
 
-        assertThat(mailboxCaptor1.getValue()).matches(mailbox -> mailbox.getMailboxId().equals(mailboxId));
-        assertThat(mailboxCaptor2.getValue()).matches(mailbox -> mailbox.getMailboxId().equals(mailboxId));
-        assertThat(messageCaptor.getValue()).matches(message -> message.getMailboxId().equals(mailboxId)
-            && message.getUid().equals(createdMessage.getUid()));
+        assertThat(mailboxCaptor1.getValue()).satisfies(mailbox -> assertThat(mailbox.getMailboxId()).isEqualTo(mailboxId));
+        assertThat(mailboxCaptor2.getValue()).satisfies(mailbox -> assertThat(mailbox.getMailboxId()).isEqualTo(mailboxId));
+        assertThat(messageCaptor.getValue()).satisfies(message -> {
+            assertThat(message.getMailboxId()).isEqualTo(mailboxId);
+            assertThat(message.getUid()).isEqualTo(createdMessage.getUid());
+        });
     }
 
     @Test
@@ -109,10 +111,12 @@ public class ReIndexerImplTest {
         verify(messageSearchIndex).add(any(MailboxSession.class), mailboxCaptor2.capture(),
messageCaptor.capture());
         verifyNoMoreInteractions(messageSearchIndex);
 
-        assertThat(mailboxCaptor1.getValue()).matches(mailbox -> mailbox.getMailboxId().equals(mailboxId));
-        assertThat(mailboxCaptor2.getValue()).matches(mailbox -> mailbox.getMailboxId().equals(mailboxId));
-        assertThat(messageCaptor.getValue()).matches(message -> message.getMailboxId().equals(mailboxId)
-            && message.getUid().equals(createdMessage.getUid()));
+        assertThat(mailboxCaptor1.getValue()).satisfies(mailbox -> assertThat(mailbox.getMailboxId()).isEqualTo(mailboxId));
+        assertThat(mailboxCaptor2.getValue()).satisfies(mailbox -> assertThat(mailbox.getMailboxId()).isEqualTo(mailboxId));
+        assertThat(messageCaptor.getValue()).satisfies(message -> {
+            assertThat(message.getMailboxId()).isEqualTo(mailboxId);
+            assertThat(message.getUid()).isEqualTo(createdMessage.getUid());
+        });
     }
 
     @Test
@@ -133,10 +137,12 @@ public class ReIndexerImplTest {
         verify(messageSearchIndex).add(any(MailboxSession.class), mailboxCaptor2.capture(),
messageCaptor.capture());
         verifyNoMoreInteractions(messageSearchIndex);
 
-        assertThat(mailboxCaptor1.getValue()).matches(mailbox -> mailbox.getMailboxId().equals(mailboxId));
-        assertThat(mailboxCaptor2.getValue()).matches(mailbox -> mailbox.getMailboxId().equals(mailboxId));
-        assertThat(messageCaptor.getValue()).matches(message -> message.getMailboxId().equals(mailboxId)
-            && message.getUid().equals(createdMessage.getUid()));
+        assertThat(mailboxCaptor1.getValue()).satisfies(mailbox -> assertThat(mailbox.getMailboxId()).isEqualTo(mailboxId));
+        assertThat(mailboxCaptor2.getValue()).satisfies(mailbox -> assertThat(mailbox.getMailboxId()).isEqualTo(mailboxId));
+        assertThat(messageCaptor.getValue()).satisfies(message -> {
+            assertThat(message.getMailboxId()).isEqualTo(mailboxId);
+            assertThat(message.getUid()).isEqualTo(createdMessage.getUid());
+        });
     }
 
     @Test
@@ -155,9 +161,11 @@ public class ReIndexerImplTest {
         verify(messageSearchIndex).add(any(MailboxSession.class), mailboxCaptor.capture(),
messageCaptor.capture());
         verifyNoMoreInteractions(messageSearchIndex);
 
-        assertThat(mailboxCaptor.getValue()).matches(mailbox -> mailbox.getMailboxId().equals(mailboxId));
-        assertThat(messageCaptor.getValue()).matches(message -> message.getMailboxId().equals(mailboxId)
-            && message.getUid().equals(createdMessage.getUid()));
+        assertThat(mailboxCaptor.getValue()).satisfies(mailbox -> assertThat(mailbox.getMailboxId()).isEqualTo(mailboxId));
+        assertThat(messageCaptor.getValue()).satisfies(message -> {
+            assertThat(message.getMailboxId()).isEqualTo(mailboxId);
+            assertThat(message.getUid()).isEqualTo(createdMessage.getUid());
+        });
     }
 
     @Test
@@ -176,9 +184,11 @@ public class ReIndexerImplTest {
         verify(messageSearchIndex).add(any(MailboxSession.class), mailboxCaptor.capture(),
messageCaptor.capture());
         verifyNoMoreInteractions(messageSearchIndex);
 
-        assertThat(mailboxCaptor.getValue()).matches(mailbox -> mailbox.getMailboxId().equals(mailboxId));
-        assertThat(messageCaptor.getValue()).matches(message -> message.getMailboxId().equals(mailboxId)
-            && message.getUid().equals(createdMessage.getUid()));
+        assertThat(mailboxCaptor.getValue()).satisfies(mailbox -> assertThat(mailbox.getMailboxId()).isEqualTo(mailboxId));
+        assertThat(messageCaptor.getValue()).satisfies(message -> {
+            assertThat(message.getMailboxId()).isEqualTo(mailboxId);
+            assertThat(message.getUid()).isEqualTo(createdMessage.getUid());
+        });
     }
 
     @Test
@@ -218,9 +228,11 @@ public class ReIndexerImplTest {
         verify(messageSearchIndex).add(any(MailboxSession.class), mailboxCaptor.capture(),
messageCaptor.capture());
         verifyNoMoreInteractions(messageSearchIndex);
 
-        assertThat(mailboxCaptor.getValue()).matches(mailbox -> mailbox.getMailboxId().equals(mailboxId));
-        assertThat(messageCaptor.getValue()).matches(message -> message.getMailboxId().equals(mailboxId)
-            && message.getUid().equals(createdMessage.getUid()));
+        assertThat(mailboxCaptor.getValue()).satisfies(mailbox -> assertThat(mailbox.getMailboxId()).isEqualTo(mailboxId));
+        assertThat(messageCaptor.getValue()).satisfies(message -> {
+            assertThat(message.getMailboxId()).isEqualTo(mailboxId);
+            assertThat(message.getUid()).isEqualTo(createdMessage.getUid());
+        });
     }
 
     @Test
@@ -234,7 +246,7 @@ public class ReIndexerImplTest {
         verify(messageSearchIndex).deleteAll(any(MailboxSession.class), mailboxCaptor.capture());
         verifyNoMoreInteractions(messageSearchIndex);
 
-        assertThat(mailboxCaptor.getValue()).matches(mailbox -> mailbox.getMailboxId().equals(mailboxId));
+        assertThat(mailboxCaptor.getValue()).satisfies(mailbox -> assertThat(mailbox.getMailboxId()).isEqualTo(mailboxId));
     }
 
     @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