james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [11/12] james-project git commit: JAMES-2543 remove last usages of org.junit.Assert
Date Tue, 11 Sep 2018 09:06:47 GMT
JAMES-2543 remove last usages of org.junit.Assert


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

Branch: refs/heads/master
Commit: e73667eb4fc691402f7876776ae43e205ee21e02
Parents: 491e864
Author: Matthieu Baechler <matthieu@apache.org>
Authored: Thu Sep 6 18:35:18 2018 +0200
Committer: Matthieu Baechler <matthieu@apache.org>
Committed: Mon Sep 10 21:25:42 2018 +0200

----------------------------------------------------------------------
 .../java/org/apache/james/core/MailAddressTest.java    |  4 ++--
 .../org/apache/james/mailbox/hbase/HBaseUtilsTest.java |  7 +++----
 .../mailbox/hbase/mail/HBaseMailboxMapperTest.java     |  3 +--
 .../server/core/MimeMessageCopyOnWriteProxyTest.java   | 13 ++++++-------
 .../james/karaf/features/KarafLiveTestSupport.java     |  1 -
 5 files changed, 12 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/e73667eb/core/src/test/java/org/apache/james/core/MailAddressTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/james/core/MailAddressTest.java b/core/src/test/java/org/apache/james/core/MailAddressTest.java
index e9e1e67..823e55c 100644
--- a/core/src/test/java/org/apache/james/core/MailAddressTest.java
+++ b/core/src/test/java/org/apache/james/core/MailAddressTest.java
@@ -20,12 +20,12 @@
 package org.apache.james.core;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Fail.fail;
 
 import javax.mail.internet.AddressException;
 import javax.mail.internet.InternetAddress;
 
 import org.assertj.core.api.Assertions;
-import org.junit.Assert;
 import org.junit.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
@@ -107,7 +107,7 @@ public class MailAddressTest {
             try {
                 a = new MailAddress(goodAddress);
             } catch (AddressException e) {
-                Assert.fail(e.getMessage());
+                fail(e.getMessage());
             }
         }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/e73667eb/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseUtilsTest.java
----------------------------------------------------------------------
diff --git a/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseUtilsTest.java
b/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseUtilsTest.java
index 224ca16..cf1ad95 100644
--- a/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseUtilsTest.java
+++ b/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseUtilsTest.java
@@ -43,7 +43,6 @@ import static org.apache.james.mailbox.hbase.HBaseUtils.toPut;
 import static org.apache.james.mailbox.hbase.PropertyConvertor.getProperty;
 import static org.apache.james.mailbox.hbase.PropertyConvertor.getValue;
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertArrayEquals;
 
 import java.util.Date;
 import java.util.UUID;
@@ -79,7 +78,7 @@ public class HBaseUtilsTest {
         HBaseId uuid = mailbox.getMailboxId();
         byte[] expResult = uuid.toBytes();
         byte[] result = mailbox.getMailboxId().toBytes();
-        assertArrayEquals(expResult, result);
+        assertThat(result).isEqualTo(expResult);
 
         HBaseId newUUID = hBaseIdFromRowKey(result);
         assertThat(newUUID).isEqualTo(uuid);
@@ -96,7 +95,7 @@ public class HBaseUtilsTest {
         final HBaseMailbox instance = new HBaseMailbox(new MailboxPath("gsoc", "ieugen",
"INBOX"), 1234);
 
         Put result = toPut(instance);
-        assertArrayEquals(instance.getMailboxId().toBytes(), result.getRow());
+        assertThat(result.getRow()).isEqualTo(instance.getMailboxId().toBytes());
         assertThat(result.has(MAILBOX_CF, MAILBOX_USER, Bytes.toBytes(instance.getUser()))).isTrue();
         assertThat(result.has(MAILBOX_CF, MAILBOX_NAME, Bytes.toBytes(instance.getName()))).isTrue();
         assertThat(result.has(MAILBOX_CF, MAILBOX_NAMESPACE, Bytes.toBytes(instance.getNamespace()))).isTrue();
@@ -129,7 +128,7 @@ public class HBaseUtilsTest {
     public void testSubscriptionToPut() {
         Subscription subscription = new SimpleSubscription("ieugen", "INBOX");
         Put put = toPut(subscription);
-        assertArrayEquals(Bytes.toBytes(subscription.getUser()), put.getRow());
+        assertThat(put.getRow()).isEqualTo(Bytes.toBytes(subscription.getUser()));
         assertThat(put.has(SUBSCRIPTION_CF, Bytes.toBytes(subscription.getMailbox()), MARKER_PRESENT)).isTrue();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/e73667eb/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/mail/HBaseMailboxMapperTest.java
----------------------------------------------------------------------
diff --git a/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/mail/HBaseMailboxMapperTest.java
b/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/mail/HBaseMailboxMapperTest.java
index 3aef240..dfc7b3b 100644
--- a/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/mail/HBaseMailboxMapperTest.java
+++ b/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/mail/HBaseMailboxMapperTest.java
@@ -28,7 +28,6 @@ import static org.apache.james.mailbox.hbase.HBaseNames.SUBSCRIPTIONS_TABLE;
 import static org.apache.james.mailbox.hbase.HBaseNames.SUBSCRIPTION_CF;
 import static org.apache.james.mailbox.hbase.HBaseUtils.mailboxFromResult;
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertArrayEquals;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -212,7 +211,7 @@ public class HBaseMailboxMapperTest {
             assertThat(newValue.getLastUid()).isEqualTo(mlbx.getLastUid());
             assertThat(newValue.getUidValidity()).isEqualTo(mlbx.getUidValidity());
             assertThat(newValue.getHighestModSeq()).isEqualTo(mlbx.getHighestModSeq());
-            assertArrayEquals(mlbx.getMailboxId().toBytes(), newValue.getMailboxId().toBytes());
+            assertThat(newValue.getMailboxId().toBytes()).isEqualTo(mlbx.getMailboxId().toBytes());
         } finally {
             mailboxes.close();
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/e73667eb/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageCopyOnWriteProxyTest.java
----------------------------------------------------------------------
diff --git a/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageCopyOnWriteProxyTest.java
b/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageCopyOnWriteProxyTest.java
index 1bf1566..8a1889a 100644
--- a/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageCopyOnWriteProxyTest.java
+++ b/server/container/core/src/test/java/org/apache/james/server/core/MimeMessageCopyOnWriteProxyTest.java
@@ -20,7 +20,6 @@ package org.apache.james.server.core;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Fail.fail;
-import static org.junit.Assert.assertNotSame;
 
 import java.util.ArrayList;
 
@@ -55,8 +54,8 @@ public class MimeMessageCopyOnWriteProxyTest extends MimeMessageFromStreamTest
{
         MailImpl mail = new MailImpl("test", new MailAddress("test@test.com"), r, messageFromSources);
         MailImpl m2 = MailImpl.duplicate(mail);
         System.out.println("mail: " + getReferences(mail.getMessage()) + " m2: " + getReferences(m2.getMessage()));
-        assertNotSame(m2, mail);
-        assertNotSame(m2.getMessage(), mail.getMessage());
+        assertThat(mail).isNotSameAs((m2));
+        assertThat(mail.getMessage()).isNotSameAs(m2.getMessage());
         // test that the wrapped message is the same
         assertThat(isSameMimeMessage(m2.getMessage(), mail.getMessage())).isTrue();
         // test it is the same after read only operations!
@@ -81,8 +80,8 @@ public class MimeMessageCopyOnWriteProxyTest extends MimeMessageFromStreamTest
{
         MailImpl mail = new MailImpl("test", new MailAddress("test@test.com"), r, messageFromSources);
         MailImpl m2 = MailImpl.duplicate(mail);
         System.out.println("mail: " + getReferences(mail.getMessage()) + " m2: " + getReferences(m2.getMessage()));
-        assertNotSame(m2, mail);
-        assertNotSame(m2.getMessage(), mail.getMessage());
+        assertThat(mail).isNotSameAs((m2));
+        assertThat(mail.getMessage()).isNotSameAs(m2.getMessage());
         // test that the wrapped message is the same
         assertThat(isSameMimeMessage(m2.getMessage(), mail.getMessage())).isTrue();
         // test it is the same after real only operations!
@@ -100,7 +99,7 @@ public class MimeMessageCopyOnWriteProxyTest extends MimeMessageFromStreamTest
{
         Mail m2clone = m2.duplicate("clone2");
         assertThat(isSameMimeMessage(m2clone.getMessage(), m2.getMessage())).isTrue();
         MimeMessage mm = getWrappedMessage(m2.getMessage());
-        assertNotSame(m2.getMessage(), m2clone.getMessage());
+        assertThat(m2clone.getMessage()).isNotSameAs(m2.getMessage());
         // test that m2clone has a valid wrapped message
         MimeMessage mm3 = getWrappedMessage(m2clone.getMessage());
         assertThat(mm3).isNotNull();
@@ -133,7 +132,7 @@ public class MimeMessageCopyOnWriteProxyTest extends MimeMessageFromStreamTest
{
         Mail mailClone = MailImpl.duplicate(mail);
         assertThat(isSameMimeMessage(mailClone.getMessage(), mail.getMessage())).isTrue();
         MimeMessage mm = getWrappedMessage(mail.getMessage());
-        assertNotSame(mail.getMessage(), mailClone.getMessage());
+        assertThat(mailClone.getMessage()).isNotSameAs(mail.getMessage());
         // dispose mail and check that the clone has still a valid message and
         // it is the same!
         LifecycleUtil.dispose(mail);

http://git-wip-us.apache.org/repos/asf/james-project/blob/e73667eb/server/karaf/integration/src/test/java/org/apache/james/karaf/features/KarafLiveTestSupport.java
----------------------------------------------------------------------
diff --git a/server/karaf/integration/src/test/java/org/apache/james/karaf/features/KarafLiveTestSupport.java
b/server/karaf/integration/src/test/java/org/apache/james/karaf/features/KarafLiveTestSupport.java
index 536f720..c00c118 100644
--- a/server/karaf/integration/src/test/java/org/apache/james/karaf/features/KarafLiveTestSupport.java
+++ b/server/karaf/integration/src/test/java/org/apache/james/karaf/features/KarafLiveTestSupport.java
@@ -4,7 +4,6 @@ import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.kara
 import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.keepRuntimeFolder;
 import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.logLevel;
 import static org.assertj.core.api.Fail.fail;
-import static org.junit.Assert.assertTrue;
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 


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