james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [07/12] james-project git commit: JAMES-2543 replace a bunch of assertEquals by assertThat
Date Tue, 11 Sep 2018 09:06:43 GMT
http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/container/guice/onami/src/test/java/org/apache/james/onami/lifecycle/MultiLifeCycleTestCase.java
----------------------------------------------------------------------
diff --git a/server/container/guice/onami/src/test/java/org/apache/james/onami/lifecycle/MultiLifeCycleTestCase.java b/server/container/guice/onami/src/test/java/org/apache/james/onami/lifecycle/MultiLifeCycleTestCase.java
index 5ef8c9d..5d60a53 100644
--- a/server/container/guice/onami/src/test/java/org/apache/james/onami/lifecycle/MultiLifeCycleTestCase.java
+++ b/server/container/guice/onami/src/test/java/org/apache/james/onami/lifecycle/MultiLifeCycleTestCase.java
@@ -21,13 +21,13 @@ package org.apache.james.onami.lifecycle;
 
 import static com.google.inject.matcher.Matchers.any;
 import static java.util.Arrays.asList;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.lang.annotation.Annotation;
 import java.util.List;
 
 import javax.inject.Inject;
 
-import org.junit.Assert;
 import org.junit.Test;
 
 import com.google.inject.AbstractModule;
@@ -40,7 +40,7 @@ public class MultiLifeCycleTestCase {
     public void testOrdering() {
         Module lifeCycleModule = new TestLifeCycleModule(asList(TestAnnotationA.class, TestAnnotationB.class, TestAnnotationC.class));
         MultiLifeCycleObject obj = Guice.createInjector(lifeCycleModule).getInstance(MultiLifeCycleObject.class);
-        Assert.assertEquals("aaabbbc", obj.toString());
+        assertThat(obj.toString()).isEqualTo("aaabbbc");
     }
 
     public static class Foo {
@@ -59,14 +59,14 @@ public class MultiLifeCycleTestCase {
         Injector injector = Guice.createInjector(moduleA, moduleB, moduleC);
         MultiLifeCycleObject obj = injector.getInstance(MultiLifeCycleObject.class);
 
-        Assert.assertEquals(obj.toString(), "");
+        assertThat("").isEqualTo(obj.toString());
 
         injector.getInstance(LifeCycleStageModule.key(TestAnnotationA.class)).stage();
-        Assert.assertEquals("aaa", obj.toString());
+        assertThat(obj.toString()).isEqualTo("aaa");
         injector.getInstance(LifeCycleStageModule.key(TestAnnotationB.class)).stage();
-        Assert.assertEquals("aaabbb", obj.toString());
+        assertThat(obj.toString()).isEqualTo("aaabbb");
         injector.getInstance(LifeCycleStageModule.key(TestAnnotationC.class)).stage();
-        Assert.assertEquals("aaabbbc", obj.toString());
+        assertThat(obj.toString()).isEqualTo("aaabbbc");
 
         injector.getInstance(Foo.class);
     }
@@ -89,11 +89,11 @@ public class MultiLifeCycleTestCase {
         injector.getInstance(StageObject2.class);
 
         injector.getInstance(LifeCycleStageModule.key(TestAnnotationA.class)).stage();
-        Assert.assertEquals("1a2a", str.toString());
+        assertThat(str.toString()).isEqualTo("1a2a");
         str.setLength(0);
 
         injector.getInstance(LifeCycleStageModule.key(TestAnnotationB.class)).stage();
-        Assert.assertEquals("2b1b", str.toString());
+        assertThat(str.toString()).isEqualTo("2b1b");
     }
 
     private static class TestLifeCycleModule extends LifeCycleModule {

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/container/guice/onami/src/test/java/org/apache/james/onami/lifecycle/StagingOrderTestCase.java
----------------------------------------------------------------------
diff --git a/server/container/guice/onami/src/test/java/org/apache/james/onami/lifecycle/StagingOrderTestCase.java b/server/container/guice/onami/src/test/java/org/apache/james/onami/lifecycle/StagingOrderTestCase.java
index 5b0788d..dbb6723 100644
--- a/server/container/guice/onami/src/test/java/org/apache/james/onami/lifecycle/StagingOrderTestCase.java
+++ b/server/container/guice/onami/src/test/java/org/apache/james/onami/lifecycle/StagingOrderTestCase.java
@@ -19,11 +19,12 @@
 
 package org.apache.james.onami.lifecycle;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.junit.Assert;
 import org.junit.Test;
 
 public class StagingOrderTestCase {
@@ -33,7 +34,7 @@ public class StagingOrderTestCase {
         DefaultStager<TestAnnotationA> stager = makeStager(order, DefaultStager.Order.FIRST_IN_FIRST_OUT);
         stager.stage();
 
-        Assert.assertEquals(Arrays.asList(1, 2, 3), order);
+        assertThat(order).isEqualTo(Arrays.asList(1, 2, 3));
     }
 
     @Test
@@ -42,7 +43,7 @@ public class StagingOrderTestCase {
         DefaultStager<TestAnnotationA> stager = makeStager(order, DefaultStager.Order.FIRST_IN_LAST_OUT);
         stager.stage();
 
-        Assert.assertEquals(Arrays.asList(3, 2, 1), order);
+        assertThat(order).isEqualTo(Arrays.asList(3, 2, 1));
     }
 
     private DefaultStager<TestAnnotationA> makeStager(final List<Integer> order, DefaultStager.Order stagingOrder) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/container/util/src/test/java/org/apache/james/util/BodyOffsetInputStreamTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/BodyOffsetInputStreamTest.java b/server/container/util/src/test/java/org/apache/james/util/BodyOffsetInputStreamTest.java
index 645d337..5826c7f 100644
--- a/server/container/util/src/test/java/org/apache/james/util/BodyOffsetInputStreamTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/BodyOffsetInputStreamTest.java
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.util;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -37,8 +37,8 @@ public class BodyOffsetInputStreamTest {
         while (in.read() != -1) {
             // consume stream
         }
-        assertEquals(expectedOffset, in.getBodyStartOffset());
-        assertEquals(bytes, in.getReadBytes());
+        assertThat(in.getBodyStartOffset()).isEqualTo(expectedOffset);
+        assertThat(in.getReadBytes()).isEqualTo(bytes);
         in.close();
     }
     
@@ -51,8 +51,8 @@ public class BodyOffsetInputStreamTest {
         while (in.read(b) != -1) {
             // consume stream
         }
-        assertEquals(expectedOffset, in.getBodyStartOffset());
-        assertEquals(bytes, in.getReadBytes());
+        assertThat(in.getBodyStartOffset()).isEqualTo(expectedOffset);
+        assertThat(in.getReadBytes()).isEqualTo(bytes);
         in.close();
     }
     
@@ -65,8 +65,8 @@ public class BodyOffsetInputStreamTest {
         while (in.read(b) != -1) {
             // consume stream
         }
-        assertEquals(expectedOffset, in.getBodyStartOffset());
-        assertEquals(bytes, in.getReadBytes());
+        assertThat(in.getBodyStartOffset()).isEqualTo(expectedOffset);
+        assertThat(in.getReadBytes()).isEqualTo(bytes);
         in.close();
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/container/util/src/test/java/org/apache/james/util/retry/DoublingRetryScheduleTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/retry/DoublingRetryScheduleTest.java b/server/container/util/src/test/java/org/apache/james/util/retry/DoublingRetryScheduleTest.java
index 02b0956..05f3e18 100644
--- a/server/container/util/src/test/java/org/apache/james/util/retry/DoublingRetryScheduleTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/retry/DoublingRetryScheduleTest.java
@@ -20,7 +20,6 @@
 package org.apache.james.util.retry;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
 
 import org.apache.james.util.retry.api.RetrySchedule;
 import org.junit.Test;
@@ -36,10 +35,10 @@ public class DoublingRetryScheduleTest {
     @Test
     public final void testDoublingRetrySchedule() {
     assertThat(RetrySchedule.class.isAssignableFrom(DoublingRetrySchedule.class)).isTrue();
-    assertEquals(0, new DoublingRetrySchedule(0, 0).getInterval(0));
-    assertEquals(0, new DoublingRetrySchedule(-1, -1).getInterval(0));
-    assertEquals(0, new DoublingRetrySchedule(-1, 0).getInterval(0));
-    assertEquals(0, new DoublingRetrySchedule(0, -1).getInterval(0));
+    assertThat(new DoublingRetrySchedule(0, 0).getInterval(0)).isEqualTo(0);
+    assertThat(new DoublingRetrySchedule(-1, -1).getInterval(0)).isEqualTo(0);
+    assertThat(new DoublingRetrySchedule(-1, 0).getInterval(0)).isEqualTo(0);
+    assertThat(new DoublingRetrySchedule(0, -1).getInterval(0)).isEqualTo(0);
     }
 
     /**
@@ -47,30 +46,30 @@ public class DoublingRetryScheduleTest {
      */
     @Test
     public final void testGetInterval() {
-    assertEquals(0, new DoublingRetrySchedule(0, 8).getInterval(0));
-    assertEquals(1, new DoublingRetrySchedule(0, 8).getInterval(1));
-    assertEquals(2, new DoublingRetrySchedule(0, 8).getInterval(2));
-    assertEquals(4, new DoublingRetrySchedule(0, 8).getInterval(3));
-    assertEquals(8, new DoublingRetrySchedule(0, 8).getInterval(4));
-    assertEquals(8, new DoublingRetrySchedule(0, 8).getInterval(5));
+    assertThat(new DoublingRetrySchedule(0, 8).getInterval(0)).isEqualTo(0);
+    assertThat(new DoublingRetrySchedule(0, 8).getInterval(1)).isEqualTo(1);
+    assertThat(new DoublingRetrySchedule(0, 8).getInterval(2)).isEqualTo(2);
+    assertThat(new DoublingRetrySchedule(0, 8).getInterval(3)).isEqualTo(4);
+    assertThat(new DoublingRetrySchedule(0, 8).getInterval(4)).isEqualTo(8);
+    assertThat(new DoublingRetrySchedule(0, 8).getInterval(5)).isEqualTo(8);
 
-    assertEquals(1, new DoublingRetrySchedule(1, 8).getInterval(0));
-    assertEquals(2, new DoublingRetrySchedule(1, 8).getInterval(1));
-    assertEquals(4, new DoublingRetrySchedule(1, 8).getInterval(2));
-    assertEquals(8, new DoublingRetrySchedule(1, 8).getInterval(3));
-    assertEquals(8, new DoublingRetrySchedule(1, 8).getInterval(4));
+    assertThat(new DoublingRetrySchedule(1, 8).getInterval(0)).isEqualTo(1);
+    assertThat(new DoublingRetrySchedule(1, 8).getInterval(1)).isEqualTo(2);
+    assertThat(new DoublingRetrySchedule(1, 8).getInterval(2)).isEqualTo(4);
+    assertThat(new DoublingRetrySchedule(1, 8).getInterval(3)).isEqualTo(8);
+    assertThat(new DoublingRetrySchedule(1, 8).getInterval(4)).isEqualTo(8);
 
-    assertEquals(3, new DoublingRetrySchedule(3, 12).getInterval(0));
-    assertEquals(6, new DoublingRetrySchedule(3, 12).getInterval(1));
-    assertEquals(12, new DoublingRetrySchedule(3, 12).getInterval(2));
-    assertEquals(12, new DoublingRetrySchedule(3, 12).getInterval(3));
+    assertThat(new DoublingRetrySchedule(3, 12).getInterval(0)).isEqualTo(3);
+    assertThat(new DoublingRetrySchedule(3, 12).getInterval(1)).isEqualTo(6);
+    assertThat(new DoublingRetrySchedule(3, 12).getInterval(2)).isEqualTo(12);
+    assertThat(new DoublingRetrySchedule(3, 12).getInterval(3)).isEqualTo(12);
 
-    assertEquals(0, new DoublingRetrySchedule(0, 8, 1000).getInterval(0));
-    assertEquals(1000, new DoublingRetrySchedule(0, 8, 1000).getInterval(1));
-    assertEquals(2000, new DoublingRetrySchedule(0, 8, 1000).getInterval(2));
-    assertEquals(4000, new DoublingRetrySchedule(0, 8, 1000).getInterval(3));
-    assertEquals(8000, new DoublingRetrySchedule(0, 8, 1000).getInterval(4));
-    assertEquals(8000, new DoublingRetrySchedule(0, 8, 1000).getInterval(5));
+    assertThat(new DoublingRetrySchedule(0, 8, 1000).getInterval(0)).isEqualTo(0);
+    assertThat(new DoublingRetrySchedule(0, 8, 1000).getInterval(1)).isEqualTo(1000);
+    assertThat(new DoublingRetrySchedule(0, 8, 1000).getInterval(2)).isEqualTo(2000);
+    assertThat(new DoublingRetrySchedule(0, 8, 1000).getInterval(3)).isEqualTo(4000);
+    assertThat(new DoublingRetrySchedule(0, 8, 1000).getInterval(4)).isEqualTo(8000);
+    assertThat(new DoublingRetrySchedule(0, 8, 1000).getInterval(5)).isEqualTo(8000);
     }
 
     /**
@@ -78,7 +77,7 @@ public class DoublingRetryScheduleTest {
      */
     @Test
     public final void testToString() {
-    assertEquals("DoublingRetrySchedule [startInterval=0, maxInterval=1, multiplier=1]", new DoublingRetrySchedule(0,
-        1).toString());
+    assertThat(new DoublingRetrySchedule(0,
+        1).toString()).isEqualTo("DoublingRetrySchedule [startInterval=0, maxInterval=1, multiplier=1]");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java b/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java
index 4da42e9..800ca50 100644
--- a/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java
@@ -20,7 +20,6 @@
 package org.apache.james.util.retry;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -84,7 +83,7 @@ public class ExceptionRetryHandlerTest {
                 return "Hi!";
             }
         }.perform();
-        assertEquals("Hi!", result);
+        assertThat(result).isEqualTo("Hi!");
 
         try {
             new ExceptionRetryHandler(
@@ -98,7 +97,7 @@ public class ExceptionRetryHandlerTest {
         } catch (Exception ex) {
             // no-op
         }
-        assertEquals("Hi!", result);
+        assertThat(result).isEqualTo("Hi!");
     }
 
     @Test
@@ -123,7 +122,7 @@ public class ExceptionRetryHandlerTest {
         } catch (Exception ex) {
             // no-op
         }
-        assertEquals(7, results.size());
+        assertThat(results.size()).isEqualTo(7);
     }
 
     @Test
@@ -136,7 +135,7 @@ public class ExceptionRetryHandlerTest {
                 return "Hi!";
             }
         };
-        assertEquals("Hi!", handler.operation());
+        assertThat(handler.operation()).isEqualTo("Hi!");
     }
 
     @Test
@@ -149,6 +148,6 @@ public class ExceptionRetryHandlerTest {
                 return null;
             }
         };
-        assertEquals(8, handler.getRetryInterval(8));
+        assertThat(handler.getRetryInterval(8)).isEqualTo(8);
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java b/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java
index bbbeced..6b5cf36 100644
--- a/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java
@@ -20,7 +20,6 @@
 package org.apache.james.util.retry.naming;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
 
 import javax.naming.Context;
 import javax.naming.NamingException;
@@ -82,7 +81,7 @@ public class NamingExceptionRetryHandlerTest {
                 return "Hi!";
             }
         }.perform();
-        assertEquals("Hi!", result);
+        assertThat(result).isEqualTo("Hi!");
 
         try {
             new NamingExceptionRetryHandler(
@@ -96,6 +95,6 @@ public class NamingExceptionRetryHandlerTest {
         } catch (NamingException ex) {
             // no-op
         }
-        assertEquals("Hi!", result);
+        assertThat(result).isEqualTo("Hi!");
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/data/data-memory/src/test/java/org/apache/james/user/memory/UsersRepositoryManagementTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-memory/src/test/java/org/apache/james/user/memory/UsersRepositoryManagementTest.java b/server/data/data-memory/src/test/java/org/apache/james/user/memory/UsersRepositoryManagementTest.java
index ed93a8f..8ea0b5e 100644
--- a/server/data/data-memory/src/test/java/org/apache/james/user/memory/UsersRepositoryManagementTest.java
+++ b/server/data/data-memory/src/test/java/org/apache/james/user/memory/UsersRepositoryManagementTest.java
@@ -19,7 +19,6 @@
 package org.apache.james.user.memory;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
 import static org.assertj.core.api.Fail.fail;
 
 import java.util.Arrays;
@@ -45,13 +44,13 @@ public class UsersRepositoryManagementTest {
 
     @Test
     public void testUserCount() throws Exception {
-        assertEquals("no user yet", 0, userManagement.countUsers());
+        assertThat(userManagement.countUsers()).describedAs("no user yet").isEqualTo(0);
         usersRepository.addUser("testcount1", "testCount");
-        assertEquals("1 user", 1, userManagement.countUsers());
+        assertThat(userManagement.countUsers()).describedAs("1 user").isEqualTo(1);
         usersRepository.addUser("testcount2", "testCount");
-        assertEquals("2 users", 2, userManagement.countUsers());
+        assertThat(userManagement.countUsers()).describedAs("2 users").isEqualTo(2);
         usersRepository.removeUser("testcount1");
-        assertEquals("1 user", 1, userManagement.countUsers());
+        assertThat(userManagement.countUsers()).describedAs("1 user").isEqualTo(1);
     }
 
     @Test
@@ -82,7 +81,7 @@ public class UsersRepositoryManagementTest {
         }
 
         String[] userNames = userManagement.listAllUsers();
-        assertEquals("user count", users.size(), userNames.length);
+        assertThat(userNames.length).describedAs("user count").isEqualTo(users.size());
 
         for (String user : userNames) {
             if (!users.contains(user)) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/dns-service/dnsservice-dnsjava/src/test/java/org/apache/james/dnsservice/dnsjava/DNSJavaServiceTest.java
----------------------------------------------------------------------
diff --git a/server/dns-service/dnsservice-dnsjava/src/test/java/org/apache/james/dnsservice/dnsjava/DNSJavaServiceTest.java b/server/dns-service/dnsservice-dnsjava/src/test/java/org/apache/james/dnsservice/dnsjava/DNSJavaServiceTest.java
index 5464f2a..ce3f7eb 100644
--- a/server/dns-service/dnsservice-dnsjava/src/test/java/org/apache/james/dnsservice/dnsjava/DNSJavaServiceTest.java
+++ b/server/dns-service/dnsservice-dnsjava/src/test/java/org/apache/james/dnsservice/dnsjava/DNSJavaServiceTest.java
@@ -20,7 +20,6 @@ package org.apache.james.dnsservice.dnsjava;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Fail.fail;
-import static org.junit.Assert.assertEquals;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.Mockito.doAnswer;
@@ -101,8 +100,8 @@ public class DNSJavaServiceTest {
 
         // a.setSearchPath(new String[] { "searchdomain.com." });
         Collection<String> records = dnsServer.findMXRecords("nomx.dnstest.com.");
-        assertEquals(1, records.size());
-        assertEquals("nomx.dnstest.com.", records.iterator().next());
+        assertThat(records.size()).isEqualTo(1);
+        assertThat(records.iterator().next()).isEqualTo("nomx.dnstest.com.");
     }
 
     @Test
@@ -113,8 +112,8 @@ public class DNSJavaServiceTest {
 
         // a.setSearchPath(new String[] { "searchdomain.com." });
         Collection<String> records = dnsServer.findMXRecords("badmx.dnstest.com.");
-        assertEquals(1, records.size());
-        assertEquals("badhost.dnstest.com.", records.iterator().next());
+        assertThat(records.size()).isEqualTo(1);
+        assertThat(records.iterator().next()).isEqualTo("badhost.dnstest.com.");
         // Iterator<HostAddress> it =
         // dnsServer.getSMTPHostAddresses("badmx.dnstest.com.");
         // assertFalse(it.hasNext());
@@ -128,8 +127,8 @@ public class DNSJavaServiceTest {
 
         // dnsServer.setLookupper(new ZoneLookupper(z));
         Collection<String> records = dnsServer.findMXRecords("www.pippo.com.");
-        assertEquals(1, records.size());
-        assertEquals("pippo.com.inbound.mxlogic.net.", records.iterator().next());
+        assertThat(records.size()).isEqualTo(1);
+        assertThat(records.iterator().next()).isEqualTo("pippo.com.inbound.mxlogic.net.");
     }
 
     @Test
@@ -146,8 +145,8 @@ public class DNSJavaServiceTest {
         } catch (UnsupportedOperationException e) {
             LOGGER.info("Ignored error", e);
         }
-        assertEquals(1, res.size());
-        assertEquals("mail.test-zone.com.", res.iterator().next());
+        assertThat(res.size()).isEqualTo(1);
+        assertThat(res.iterator().next()).isEqualTo("mail.test-zone.com.");
     }
 
     /**
@@ -161,7 +160,7 @@ public class DNSJavaServiceTest {
 
         // a.setSearchPath(new String[] { "searchdomain.com." });
         Collection<String> records = dnsServer.findMXRecords("two-mx.sameprio.");
-        assertEquals(2, records.size());
+        assertThat(records.size()).isEqualTo(2);
         assertThat(records.contains("mx1.two-mx.sameprio.")).isTrue();
         assertThat(records.contains("mx2.two-mx.sameprio.")).isTrue();
     }
@@ -174,10 +173,10 @@ public class DNSJavaServiceTest {
 
         // a.setSearchPath(new String[] { "searchdomain.com." });
         ArrayList<String> records = new ArrayList<>(dnsServer.findMXRecords("three-mx.bar."));
-        assertEquals(3, records.size());
+        assertThat(records.size()).isEqualTo(3);
         assertThat(records.contains("mx1.three-mx.bar.")).isTrue();
         assertThat(records.contains("mx2.three-mx.bar.")).isTrue();
-        assertEquals("mx3.three-mx.bar.", records.get(2));
+        assertThat(records.get(2)).isEqualTo("mx3.three-mx.bar.");
 
     }
 
@@ -191,7 +190,7 @@ public class DNSJavaServiceTest {
         dnsServer.setCache(mockedCache);
         // a.setSearchPath(new String[] { "searchdomain.com." });
         Collection<String> records = dnsServer.findMXRecords("two-mx.differentprio.");
-        assertEquals(2, records.size());
+        assertThat(records.size()).isEqualTo(2);
         assertThat(records.contains("mx1.two-mx.differentprio.")).isTrue();
         assertThat(records.contains("mx2.two-mx.differentprio.")).isTrue();
 
@@ -208,7 +207,7 @@ public class DNSJavaServiceTest {
 
         // a.setSearchPath(new String[] { "searchdomain.com." });
         Collection<String> records = dnsServer.findMXRecords("one-mx.bar.");
-        assertEquals(1, records.size());
+        assertThat(records.size()).isEqualTo(1);
         assertThat(records.contains("mx1.one-mx.bar.")).isTrue();
     }
     /*

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/MXHostAddressIteratorTest.java
----------------------------------------------------------------------
diff --git a/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/MXHostAddressIteratorTest.java b/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/MXHostAddressIteratorTest.java
index def13f9..c43e061 100644
--- a/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/MXHostAddressIteratorTest.java
+++ b/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/MXHostAddressIteratorTest.java
@@ -19,9 +19,6 @@
 package org.apache.james.dnsservice.library;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 import java.net.InetAddress;
 import java.util.Arrays;

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/inetnetwork/InetNetworkBuilderTest.java
----------------------------------------------------------------------
diff --git a/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/inetnetwork/InetNetworkBuilderTest.java b/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/inetnetwork/InetNetworkBuilderTest.java
index 727b329..bc0a786 100644
--- a/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/inetnetwork/InetNetworkBuilderTest.java
+++ b/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/inetnetwork/InetNetworkBuilderTest.java
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.dnsservice.library.inetnetwork;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.net.UnknownHostException;
 
@@ -45,10 +45,10 @@ public class InetNetworkBuilderTest {
         inetNetworkBuilder = new InetNetworkBuilder(DNSFixture.DNS_SERVER_IPV4_MOCK);
 
         inetNetwork = inetNetworkBuilder.getFromString(DNSFixture.LOCALHOST_IP_V4_ADDRESS_0);
-        assertEquals("127.0.0.0/255.255.0.0", inetNetwork.toString());
+        assertThat(inetNetwork.toString()).isEqualTo("127.0.0.0/255.255.0.0");
 
         inetNetwork = inetNetworkBuilder.getFromString(DNSFixture.LOCALHOST_IP_V4_ADDRESS_1);
-        assertEquals("172.16.0.0/255.255.0.0", inetNetwork.toString());
+        assertThat(inetNetwork.toString()).isEqualTo("172.16.0.0/255.255.0.0");
 
     }
 
@@ -63,10 +63,10 @@ public class InetNetworkBuilderTest {
         inetNetworkBuilder = new InetNetworkBuilder(DNSFixture.DNS_SERVER_IPV6_MOCK);
 
         inetNetwork = inetNetworkBuilder.getFromString(DNSFixture.LOCALHOST_IP_V6_ADDRESS_0);
-        assertEquals("0:0:0:0:0:0:0:1/32768", inetNetwork.toString());
+        assertThat(inetNetwork.toString()).isEqualTo("0:0:0:0:0:0:0:1/32768");
 
         inetNetwork = inetNetworkBuilder.getFromString(DNSFixture.LOCALHOST_IP_V6_ADDRESS_1);
-        assertEquals("2781:db8:1234:0:0:0:0:0/48", inetNetwork.toString());
+        assertThat(inetNetwork.toString()).isEqualTo("2781:db8:1234:0:0:0:0:0/48");
 
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/inetnetwork/model/InetNetworkTest.java
----------------------------------------------------------------------
diff --git a/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/inetnetwork/model/InetNetworkTest.java b/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/inetnetwork/model/InetNetworkTest.java
index cf4b5d4..677950c 100644
--- a/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/inetnetwork/model/InetNetworkTest.java
+++ b/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/inetnetwork/model/InetNetworkTest.java
@@ -19,7 +19,6 @@
 package org.apache.james.dnsservice.library.inetnetwork.model;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
 
 import java.net.Inet4Address;
 import java.net.Inet6Address;
@@ -149,7 +148,7 @@ public class InetNetworkTest {
         address = InetAddress.getByAddress(getBytesFromAddress("127.0.0.1"));
         InetAddress subnetmask4 = InetAddress.getByAddress(getBytesFromAddress("255.255.255.0"));
         network4 = new Inet4Network(address, subnetmask4);
-        assertEquals("127.0.0.0/255.255.255.0", network4.toString());
+        assertThat(network4.toString()).isEqualTo("127.0.0.0/255.255.255.0");
     }
 
     /**
@@ -174,43 +173,43 @@ public class InetNetworkTest {
         address = InetAddress.getByAddress(getBytesFromAddress("2781:0db8:1234:8612:45ee:0000:f05e:0001"));
         Integer subnetmask6 = 32768;
         network6 = new Inet6Network(address, subnetmask6);
-        assertEquals("2781:db8:1234:8612:45ee:0:f05e:1/32768", network6.toString());
+        assertThat(network6.toString()).isEqualTo("2781:db8:1234:8612:45ee:0:f05e:1/32768");
 
         // Test IP V6 with subnet mask 128.
         address = InetAddress.getByAddress(getBytesFromAddress("2781:0db8:1234:8612:45ee:0000:f05e:0001"));
         subnetmask6 = 128;
         network6 = new Inet6Network(address, subnetmask6);
-        assertEquals("2781:db8:1234:8612:0:0:0:0/128", network6.toString());
+        assertThat(network6.toString()).isEqualTo("2781:db8:1234:8612:0:0:0:0/128");
 
         // Test IP V6 with subnet mask 48.
         address = InetAddress.getByAddress(getBytesFromAddress("2781:0db8:1234:8612:45ee:0000:f05e:0001"));
         subnetmask6 = 48;
         network6 = new Inet6Network(address, subnetmask6);
-        assertEquals("2781:db8:1234:0:0:0:0:0/48", network6.toString());
+        assertThat(network6.toString()).isEqualTo("2781:db8:1234:0:0:0:0:0/48");
 
         // Test IP V6 with subnet mask 16.
         address = InetAddress.getByAddress(getBytesFromAddress("2781:0db8:1234:8612:45ee:0000:f05e:0001"));
         subnetmask6 = 16;
         network6 = new Inet6Network(address, subnetmask6);
-        assertEquals("2781:db8:1200:0:0:0:0:0/16", network6.toString());
+        assertThat(network6.toString()).isEqualTo("2781:db8:1200:0:0:0:0:0/16");
 
         // Test IP V6 with subnet mask 2.
         address = InetAddress.getByAddress(getBytesFromAddress("2781:0db8:1234:8612:45ee:0000:f05e:0001"));
         subnetmask6 = 2;
         network6 = new Inet6Network(address, subnetmask6);
-        assertEquals("2781:0:0:0:0:0:0:0/2", network6.toString());
+        assertThat(network6.toString()).isEqualTo("2781:0:0:0:0:0:0:0/2");
 
         // Test IP V6 with subnet mask 1.
         address = InetAddress.getByAddress(getBytesFromAddress("2781:0db8:1234:8612:45ee:0000:f05e:0001"));
         subnetmask6 = 1;
         network6 = new Inet6Network(address, subnetmask6);
-        assertEquals("2700:0:0:0:0:0:0:0/1", network6.toString());
+        assertThat(network6.toString()).isEqualTo("2700:0:0:0:0:0:0:0/1");
 
         // Test IP V6 with subnet mask 0.
         address = InetAddress.getByAddress(getBytesFromAddress("2781:0db8:1234:8612:45ee:0000:f05e:0001"));
         subnetmask6 = 0;
         network6 = new Inet6Network(address, subnetmask6);
-        assertEquals("0:0:0:0:0:0:0:0/0", network6.toString());
+        assertThat(network6.toString()).isEqualTo("0:0:0:0:0:0:0:0/0");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/netmatcher/NetMatcherTest.java
----------------------------------------------------------------------
diff --git a/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/netmatcher/NetMatcherTest.java b/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/netmatcher/NetMatcherTest.java
index 72aa6a7..b185cf0 100644
--- a/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/netmatcher/NetMatcherTest.java
+++ b/server/dns-service/dnsservice-library/src/test/java/org/apache/james/dnsservice/library/netmatcher/NetMatcherTest.java
@@ -19,7 +19,6 @@
 package org.apache.james.dnsservice.library.netmatcher;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
 
 import java.net.UnknownHostException;
 
@@ -40,7 +39,7 @@ public class NetMatcherTest {
     @Test
     public void testIpV4NetworksUniqueness() {
         netMatcher = new NetMatcher(DNSFixture.LOCALHOST_IP_V4_ADDRESSES_DUPLICATE, DNSFixture.DNS_SERVER_IPV4_MOCK);
-        assertEquals("[172.16.0.0/255.255.0.0, 192.168.1.0/255.255.255.0]", netMatcher.toString());
+        assertThat(netMatcher.toString()).isEqualTo("[172.16.0.0/255.255.0.0, 192.168.1.0/255.255.255.0]");
     }
 
     /**
@@ -49,7 +48,7 @@ public class NetMatcherTest {
     @Test
     public void testIpV6NetworksUniqueness() {
         netMatcher = new NetMatcher(DNSFixture.LOCALHOST_IP_V6_ADDRESSES_DUPLICATE, DNSFixture.DNS_SERVER_IPV6_MOCK);
-        assertEquals("[0:0:0:0:0:0:0:1/32768, 2781:db8:1234:0:0:0:0:0/48]", netMatcher.toString());
+        assertThat(netMatcher.toString()).isEqualTo("[0:0:0:0:0:0:0:1/32768, 2781:db8:1234:0:0:0:0:0/48]");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/dns-service/dnsservice-test/src/main/java/org/apache/james/dnsservice/api/AbstractDNSServiceTest.java
----------------------------------------------------------------------
diff --git a/server/dns-service/dnsservice-test/src/main/java/org/apache/james/dnsservice/api/AbstractDNSServiceTest.java b/server/dns-service/dnsservice-test/src/main/java/org/apache/james/dnsservice/api/AbstractDNSServiceTest.java
index 9c18b7a..6b93f5d 100644
--- a/server/dns-service/dnsservice-test/src/main/java/org/apache/james/dnsservice/api/AbstractDNSServiceTest.java
+++ b/server/dns-service/dnsservice-test/src/main/java/org/apache/james/dnsservice/api/AbstractDNSServiceTest.java
@@ -19,8 +19,6 @@
 package org.apache.james.dnsservice.api;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -73,7 +71,7 @@ public class AbstractDNSServiceTest {
     @Test
     public void testLocalhost() throws UnknownHostException {
 
-        assertEquals("localhost/127.0.0.1", DNS_SERVER.getByName("localhost").toString());
+        assertThat(DNS_SERVER.getByName("localhost").toString()).isEqualTo("localhost/127.0.0.1");
 
         String localHost = DNS_SERVER.getHostName(InetAddress.getByName("127.0.0.1"));
         // We only can check if the returned localhost is not empty. Its value

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/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 fcb02a4..536f720 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
@@ -3,9 +3,8 @@ package org.apache.james.karaf.features;
 import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.karafDistributionConfiguration;
 import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.keepRuntimeFolder;
 import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.logLevel;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 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;
 
@@ -102,8 +101,7 @@ public class KarafLiveTestSupport {
     void assertBundlesAreActive() {
         for (Bundle bundle : bundleContext.getBundles()) {
             LOG.info("***** bundle {} is {}", bundle.getSymbolicName(), bundle.getState());
-            assertEquals("Bundle " + bundle.getSymbolicName() + " is not active",
-                    Bundle.ACTIVE, bundle.getState());
+            assertThat(bundle.getState()).describedAs("Bundle " + bundle.getSymbolicName() + " is not active").isEqualTo(Bundle.ACTIVE);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/MailetConfigImplTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/MailetConfigImplTest.java b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/MailetConfigImplTest.java
index 3c6762e..cd3c012 100644
--- a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/MailetConfigImplTest.java
+++ b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/MailetConfigImplTest.java
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.mailetcontainer.impl;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.ByteArrayInputStream;
 import java.util.ArrayList;
@@ -48,8 +48,8 @@ public class MailetConfigImplTest {
         config.setConfiguration(builder);
 
         String param = config.getInitParameterNames().next();
-        assertEquals("mail.debug", param);
-        assertEquals("true", config.getInitParameter(param));
+        assertThat(param).isEqualTo("mail.debug");
+        assertThat(config.getInitParameter(param)).isEqualTo("true");
     }
 
     @Test
@@ -59,8 +59,8 @@ public class MailetConfigImplTest {
         config.setConfiguration(builder);
 
         String param = config.getInitParameterNames().next();
-        assertEquals("mail.debug", param);
-        assertEquals("true", config.getInitParameter(param));
+        assertThat(param).isEqualTo("mail.debug");
+        assertThat(config.getInitParameter(param)).isEqualTo("true");
     }
 
     // See JAMES-1232
@@ -71,8 +71,8 @@ public class MailetConfigImplTest {
         config.setConfiguration(builder);
 
         String param = config.getInitParameterNames().next();
-        assertEquals("whatever", param);
-        assertEquals("value1,value2", config.getInitParameter(param));
+        assertThat(param).isEqualTo("whatever");
+        assertThat(config.getInitParameter(param)).isEqualTo("value1,value2");
     }
 
     @Test
@@ -84,14 +84,14 @@ public class MailetConfigImplTest {
         config.setConfiguration(builder);
 
         String param = config.getInitParameterNames().next();
-        assertEquals("whatever", param);
-        assertEquals(" some text ", config.getInitParameter(param));
+        assertThat(param).isEqualTo("whatever");
+        assertThat(config.getInitParameter(param)).isEqualTo(" some text ");
 
         List<String> params = new ArrayList<>();
         Iterator<String> iter = config.getInitParameterNames();
         while (iter.hasNext()) {
             params.add(iter.next());
         }
-        assertEquals(params.size(), 1);
+        assertThat(1).isEqualTo(params.size());
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java
index 0ea0021..75e2679 100644
--- a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java
+++ b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateCompositeProcessorTest.java
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.mailetcontainer.lib;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Fail.fail;
 
 import java.io.ByteArrayInputStream;
@@ -55,7 +55,7 @@ public abstract class AbstractStateCompositeProcessorTest {
                     @Override
                     public void service(Mail mail) throws MessagingException {
                         // check if the right processor was selected depending on the state
-                        assertEquals(state, mail.getState());
+                        assertThat(mail.getState()).isEqualTo(state);
                         super.service(mail);
                     }
                 };

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessorTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessorTest.java b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessorTest.java
index 10d8e42..fddedaf 100644
--- a/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessorTest.java
+++ b/server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/lib/AbstractStateMailetProcessorTest.java
@@ -19,7 +19,6 @@
 package org.apache.james.mailetcontainer.lib;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
 
 import java.io.ByteArrayInputStream;
 import java.util.Arrays;
@@ -80,9 +79,9 @@ public abstract class AbstractStateMailetProcessorTest {
             public void afterMatcher(Matcher m, String mailName, Collection<MailAddress> recipients,
                                      Collection<MailAddress> matches, long processTime, Exception e) {
                 if (MockMatcher.class.equals(m.getClass())) {
-                    assertEquals(mail.getName(), mailName);
+                    assertThat(mailName).isEqualTo(mail.getName());
                     // match one recipient
-                    assertEquals(1, matches.size());
+                    assertThat(matches.size()).isEqualTo(1);
                     assertThat(e).isNull();
                     latch.countDown();
                 }
@@ -95,19 +94,19 @@ public abstract class AbstractStateMailetProcessorTest {
 
                 if (MockMailet.class.equals(m.getClass())) {
                     //assertEquals(mail.getName(), mailName);
-                    assertEquals("test", state);
+                    assertThat(state).isEqualTo("test");
                     assertThat(e).isNull();
                     latch.countDown();
                 }
             }
         });
 
-        assertEquals(Mail.DEFAULT, mail.getState());
+        assertThat(mail.getState()).isEqualTo(Mail.DEFAULT);
         processor.service(mail);
 
 
         // the source mail should be ghosted as it reached the end of processor as only one recipient matched
-        assertEquals(Mail.GHOST, mail.getState());
+        assertThat(mail.getState()).isEqualTo(Mail.GHOST);
         latch.await();
         processor.destroy();
 
@@ -128,9 +127,9 @@ public abstract class AbstractStateMailetProcessorTest {
             public void afterMatcher(Matcher m, String mailName, Collection<MailAddress> recipients,
                                      Collection<MailAddress> matches, long processTime, Exception e) {
                 if (MockMatcher.class.equals(m.getClass())) {
-                    assertEquals(mail.getName(), mailName);
+                    assertThat(mailName).isEqualTo(mail.getName());
                     // match all recipient
-                    assertEquals(2, matches.size());
+                    assertThat(matches.size()).isEqualTo(2);
                     assertThat(e).isNull();
                     latch.countDown();
                 }
@@ -143,20 +142,20 @@ public abstract class AbstractStateMailetProcessorTest {
 
                 if (MockMailet.class.equals(m.getClass())) {
                     // the name should be the same as we have a full match
-                    assertEquals(mail.getName(), mailName);
-                    assertEquals("test", state);
+                    assertThat(mailName).isEqualTo(mail.getName());
+                    assertThat(state).isEqualTo("test");
                     assertThat(e).isNull();
                     latch.countDown();
                 }
             }
         });
 
-        assertEquals(Mail.DEFAULT, mail.getState());
+        assertThat(mail.getState()).isEqualTo(Mail.DEFAULT);
         processor.service(mail);
 
 
         // the source mail should have the new state as it was a full match
-        assertEquals("test", mail.getState());
+        assertThat(mail.getState()).isEqualTo("test");
         latch.await();
         processor.destroy();
 
@@ -178,7 +177,7 @@ public abstract class AbstractStateMailetProcessorTest {
             public void afterMatcher(Matcher m, String mailName, Collection<MailAddress> recipients,
                                      Collection<MailAddress> matches, long processTime, Exception e) {
                 if (ExceptionThrowingMatcher.class.equals(m.getClass())) {
-                    assertEquals(mail.getName(), mailName);
+                    assertThat(mailName).isEqualTo(mail.getName());
                     // match no recipient because of the error
                     assertThat(matches).isNull();
                     assertThat(e).isNotNull();
@@ -193,12 +192,12 @@ public abstract class AbstractStateMailetProcessorTest {
             }
         });
 
-        assertEquals(Mail.DEFAULT, mail.getState());
+        assertThat(mail.getState()).isEqualTo(Mail.DEFAULT);
 
         processor.service(mail);
 
         // the source mail should have state error as the exception was thrown
-        assertEquals(Mail.ERROR, mail.getState());
+        assertThat(mail.getState()).isEqualTo(Mail.ERROR);
         latch.await();
         processor.destroy();
 
@@ -234,7 +233,7 @@ public abstract class AbstractStateMailetProcessorTest {
         processor.service(mail);
 
         // the source mail should have captured the exception which was thrown
-        assertEquals(MessagingException.class, mail.getAttribute(Mail.MAILET_ERROR_ATTRIBUTE_NAME).getClass());
+        assertThat(mail.getAttribute(Mail.MAILET_ERROR_ATTRIBUTE_NAME).getClass()).isEqualTo(MessagingException.class);
         latch.await();
         processor.destroy();
     }
@@ -255,9 +254,9 @@ public abstract class AbstractStateMailetProcessorTest {
             public void afterMatcher(Matcher m, String mailName, Collection<MailAddress> recipients,
                                      Collection<MailAddress> matches, long processTime, Exception e) {
                 if (MockMatcher.class.equals(m.getClass())) {
-                    assertEquals(mail.getName(), mailName);
+                    assertThat(mailName).isEqualTo(mail.getName());
                     // match one recipient
-                    assertEquals(1, matches.size());
+                    assertThat(matches.size()).isEqualTo(1);
                     assertThat(e).isNull();
                     latch.countDown();
                 }
@@ -270,13 +269,13 @@ public abstract class AbstractStateMailetProcessorTest {
                     // the name should be not the same as we have a part match
                     assertThat(mail.getName()).isNotEqualTo(mailName);
                     assertThat(e).isNotNull();
-                    assertEquals(Mail.ERROR, state);
+                    assertThat(state).isEqualTo(Mail.ERROR);
                     latch.countDown();
                 }
             }
         });
 
-        assertEquals(Mail.DEFAULT, mail.getState());
+        assertThat(mail.getState()).isEqualTo(Mail.DEFAULT);
 
         processor.service(mail);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
index 9f2c022..50c38b6 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/ToRecipientFolderTest.java
@@ -47,7 +47,6 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -100,7 +99,7 @@ public class ToRecipientFolderTest {
             .setProperty(ToRecipientFolder.FOLDER_PARAMETER, "Junk")
             .build());
 
-        Assert.assertEquals("Junk", testee.getInitParameter(ToRecipientFolder.FOLDER_PARAMETER));
+        assertThat(testee.getInitParameter(ToRecipientFolder.FOLDER_PARAMETER)).isEqualTo("Junk");
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
index f113313..8502d60 100644
--- a/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
+++ b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
@@ -19,10 +19,6 @@
 package org.apache.james.pop3server;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
 
 import java.io.ByteArrayOutputStream;
 import java.io.Reader;
@@ -110,7 +106,7 @@ public class POP3ServerTest {
         usersRepository.addUser("known", "test2");
 
         pop3Client.login("known", "test");
-        assertEquals(0, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(0);
         assertThat(pop3Client.getReplyString().startsWith("-ERR")).isTrue();
     }
 
@@ -123,7 +119,7 @@ public class POP3ServerTest {
         pop3Client.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
 
         pop3Client.login("unknown", "test");
-        assertEquals(0, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(0);
         assertThat(pop3Client.getReplyString().startsWith("-ERR")).isTrue();
     }
 
@@ -143,16 +139,16 @@ public class POP3ServerTest {
 
         pop3Client.login("foo", "bar");
         System.err.println(pop3Client.getState());
-        assertEquals(1, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(1);
 
         entries = pop3Client.listMessages();
-        assertEquals(1, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(1);
 
         assertThat(entries).isNotNull();
-        assertEquals(entries.length, 0);
+        assertThat(0).isEqualTo(entries.length);
 
         POP3MessageInfo p3i = pop3Client.listMessage(1);
-        assertEquals(1, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(1);
         assertThat(p3i).isNull();
     }
 
@@ -185,9 +181,8 @@ public class POP3ServerTest {
         pop3Client.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
 
         pop3Client.sendCommand("unkn");
-        assertEquals(0, pop3Client.getState());
-        assertEquals("Expected -ERR as result for an unknown command", pop3Client.getReplyString().substring(0, 4),
-                "-ERR");
+        assertThat(pop3Client.getState()).isEqualTo(0);
+        assertThat("-ERR").describedAs("Expected -ERR as result for an unknown command").isEqualTo(pop3Client.getReplyString().substring(0, 4));
     }
 
     @Test
@@ -201,12 +196,12 @@ public class POP3ServerTest {
         pop3Client.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
 
         pop3Client.sendCommand("uidl");
-        assertEquals(0, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(0);
 
         pop3Client.login("foo", "bar");
 
         POP3MessageInfo[] list = pop3Client.listUniqueIdentifiers();
-        assertEquals("Found unexpected messages", 0, list.length);
+        assertThat(list.length).describedAs("Found unexpected messages").isEqualTo(0);
 
         pop3Client.disconnect();
         MailboxPath mailboxPath = MailboxPath.forUser("foo", "INBOX");
@@ -220,7 +215,7 @@ public class POP3ServerTest {
         pop3Client.login("foo", "bar");
 
         list = pop3Client.listUniqueIdentifiers();
-        assertEquals("Expected 2 messages, found: " + list.length, 2, list.length);
+        assertThat(list.length).describedAs("Expected 2 messages, found: " + list.length).isEqualTo(2);
 
         POP3MessageInfo p3i = pop3Client.listUniqueIdentifier(1);
         assertThat(p3i).isNotNull();
@@ -240,47 +235,47 @@ public class POP3ServerTest {
         pop3Client.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
 
         pop3Client.sendCommand("noop");
-        assertEquals(0, pop3Client.getState());
-        assertEquals("-ERR", pop3Client.getReplyString().substring(0, 4));
+        assertThat(pop3Client.getState()).isEqualTo(0);
+        assertThat(pop3Client.getReplyString().substring(0, 4)).isEqualTo("-ERR");
 
         pop3Client.sendCommand("stat");
-        assertEquals(0, pop3Client.getState());
-        assertEquals("-ERR", pop3Client.getReplyString().substring(0, 4));
+        assertThat(pop3Client.getState()).isEqualTo(0);
+        assertThat(pop3Client.getReplyString().substring(0, 4)).isEqualTo("-ERR");
 
         pop3Client.sendCommand("pass");
-        assertEquals(0, pop3Client.getState());
-        assertEquals("-ERR", pop3Client.getReplyString().substring(0, 4));
+        assertThat(pop3Client.getState()).isEqualTo(0);
+        assertThat(pop3Client.getReplyString().substring(0, 4)).isEqualTo("-ERR");
 
         pop3Client.sendCommand("auth");
-        assertEquals(0, pop3Client.getState());
-        assertEquals("-ERR", pop3Client.getReplyString().substring(0, 4));
+        assertThat(pop3Client.getState()).isEqualTo(0);
+        assertThat(pop3Client.getReplyString().substring(0, 4)).isEqualTo("-ERR");
 
         pop3Client.sendCommand("rset");
-        assertEquals(0, pop3Client.getState());
-        assertEquals("-ERR", pop3Client.getReplyString().substring(0, 4));
+        assertThat(pop3Client.getState()).isEqualTo(0);
+        assertThat(pop3Client.getReplyString().substring(0, 4)).isEqualTo("-ERR");
 
         pop3Client.login("foo", "bar");
 
         POP3MessageInfo[] list = pop3Client.listUniqueIdentifiers();
-        assertEquals("Found unexpected messages", 0, list.length);
+        assertThat(list.length).describedAs("Found unexpected messages").isEqualTo(0);
 
         pop3Client.sendCommand("noop");
-        assertEquals(1, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(1);
 
         pop3Client.sendCommand("pass");
-        assertEquals(1, pop3Client.getState());
-        assertEquals("-ERR", pop3Client.getReplyString().substring(0, 4));
+        assertThat(pop3Client.getState()).isEqualTo(1);
+        assertThat(pop3Client.getReplyString().substring(0, 4)).isEqualTo("-ERR");
 
         pop3Client.sendCommand("auth");
-        assertEquals(1, pop3Client.getState());
-        assertEquals("-ERR", pop3Client.getReplyString().substring(0, 4));
+        assertThat(pop3Client.getState()).isEqualTo(1);
+        assertThat(pop3Client.getReplyString().substring(0, 4)).isEqualTo("-ERR");
 
         pop3Client.sendCommand("user");
-        assertEquals(1, pop3Client.getState());
-        assertEquals("-ERR", pop3Client.getReplyString().substring(0, 4));
+        assertThat(pop3Client.getState()).isEqualTo(1);
+        assertThat(pop3Client.getReplyString().substring(0, 4)).isEqualTo("-ERR");
 
         pop3Client.sendCommand("rset");
-        assertEquals(1, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(1);
         
     }
 
@@ -304,17 +299,17 @@ public class POP3ServerTest {
         setupTestMails(session, mailboxManager.getMailbox(mailboxPath, session));
 
         pop3Client.sendCommand("retr", "1");
-        assertEquals(0, pop3Client.getState());
-        assertEquals("-ERR", pop3Client.getReplyString().substring(0, 4));
+        assertThat(pop3Client.getState()).isEqualTo(0);
+        assertThat(pop3Client.getReplyString().substring(0, 4)).isEqualTo("-ERR");
 
         pop3Client.login("foo2", "bar2");
-        assertEquals(1, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(1);
 
         POP3MessageInfo[] entries = pop3Client.listMessages();
 
         assertThat(entries).isNotNull();
-        assertEquals(2, entries.length);
-        assertEquals(1, pop3Client.getState());
+        assertThat(entries.length).isEqualTo(2);
+        assertThat(pop3Client.getState()).isEqualTo(1);
 
         Reader r = pop3Client.retrieveMessageTop(entries[0].number, 0);
 
@@ -346,23 +341,23 @@ public class POP3ServerTest {
         pop3Client.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
 
         pop3Client.login("foo2", "bar2");
-        assertEquals(1, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(1);
 
         entries = null;
 
         POP3MessageInfo stats = pop3Client.status();
-        assertEquals(1, stats.number);
-        assertEquals(5, stats.size);
+        assertThat(stats.number).isEqualTo(1);
+        assertThat(stats.size).isEqualTo(5);
 
         entries = pop3Client.listMessages();
 
         assertThat(entries).isNotNull();
-        assertEquals(1, entries.length);
-        assertEquals(1, pop3Client.getState());
+        assertThat(entries.length).isEqualTo(1);
+        assertThat(pop3Client.getState()).isEqualTo(1);
 
         // top without arguments
         pop3Client.sendCommand("top");
-        assertEquals("-ERR", pop3Client.getReplyString().substring(0, 4));
+        assertThat(pop3Client.getReplyString().substring(0, 4)).isEqualTo("-ERR");
 
         Reader r3 = pop3Client.retrieveMessageTop(entries[0].number, 0);
         assertThat(r3).isNotNull();
@@ -400,14 +395,14 @@ public class POP3ServerTest {
         }
 
         pop3Client.login("foo2", "bar2");
-        assertEquals(1, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(1);
 
         POP3MessageInfo[] listEntries = pop3Client.listMessages();
         POP3MessageInfo[] uidlEntries = pop3Client.listUniqueIdentifiers();
         POP3MessageInfo statInfo = pop3Client.status();
-        assertEquals(msgCount, listEntries.length);
-        assertEquals(msgCount, uidlEntries.length);
-        assertEquals(msgCount, statInfo.number);
+        assertThat(listEntries.length).isEqualTo(msgCount);
+        assertThat(uidlEntries.length).isEqualTo(msgCount);
+        assertThat(statInfo.number).isEqualTo(msgCount);
 
         pop3Client.sendCommand("quit");
         pop3Client.disconnect();
@@ -415,7 +410,7 @@ public class POP3ServerTest {
         pop3Client.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
 
         pop3Client.login("foo2", "bar2");
-        assertEquals(1, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(1);
 
         mailboxManager.deleteMailbox(mailboxPath, session);
 
@@ -452,43 +447,43 @@ public class POP3ServerTest {
         }
 
         pop3Client.login("foo2", "bar2");
-        assertEquals(1, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(1);
 
         POP3MessageInfo[] listEntries = pop3Client.listMessages();
         POP3MessageInfo[] uidlEntries = pop3Client.listUniqueIdentifiers();
         POP3MessageInfo statInfo = pop3Client.status();
-        assertEquals(msgCount, listEntries.length);
-        assertEquals(msgCount, uidlEntries.length);
-        assertEquals(msgCount, statInfo.number);
+        assertThat(listEntries.length).isEqualTo(msgCount);
+        assertThat(uidlEntries.length).isEqualTo(msgCount);
+        assertThat(statInfo.number).isEqualTo(msgCount);
 
         POP3Client pop3Protocol2 = new POP3Client();
         pop3Protocol2.connect(bindedAddress.getAddress().getHostAddress(), bindedAddress.getPort());
         pop3Protocol2.login("foo2", "bar2");
-        assertEquals(1, pop3Protocol2.getState());
+        assertThat(pop3Protocol2.getState()).isEqualTo(1);
 
         POP3MessageInfo[] listEntries2 = pop3Protocol2.listMessages();
         POP3MessageInfo[] uidlEntries2 = pop3Protocol2.listUniqueIdentifiers();
         POP3MessageInfo statInfo2 = pop3Protocol2.status();
-        assertEquals(msgCount, listEntries2.length);
-        assertEquals(msgCount, uidlEntries2.length);
-        assertEquals(msgCount, statInfo2.number);
+        assertThat(listEntries2.length).isEqualTo(msgCount);
+        assertThat(uidlEntries2.length).isEqualTo(msgCount);
+        assertThat(statInfo2.number).isEqualTo(msgCount);
 
         pop3Client.deleteMessage(1);
         listEntries = pop3Client.listMessages();
         uidlEntries = pop3Client.listUniqueIdentifiers();
         statInfo = pop3Client.status();
-        assertEquals(msgCount - 1, listEntries.length);
-        assertEquals(msgCount - 1, uidlEntries.length);
-        assertEquals(msgCount - 1, statInfo.number);
+        assertThat(listEntries.length).isEqualTo(msgCount - 1);
+        assertThat(uidlEntries.length).isEqualTo(msgCount - 1);
+        assertThat(statInfo.number).isEqualTo(msgCount - 1);
 
         // even after the message was deleted it should get displayed in the
         // second connection
         listEntries2 = pop3Protocol2.listMessages();
         uidlEntries2 = pop3Protocol2.listUniqueIdentifiers();
         statInfo2 = pop3Protocol2.status();
-        assertEquals(msgCount, listEntries2.length);
-        assertEquals(msgCount, uidlEntries2.length);
-        assertEquals(msgCount, statInfo2.number);
+        assertThat(listEntries2.length).isEqualTo(msgCount);
+        assertThat(uidlEntries2.length).isEqualTo(msgCount);
+        assertThat(statInfo2.number).isEqualTo(msgCount);
 
         assertThat(pop3Client.logout()).isTrue();
         pop3Client.disconnect();
@@ -498,9 +493,9 @@ public class POP3ServerTest {
         listEntries2 = pop3Protocol2.listMessages();
         uidlEntries2 = pop3Protocol2.listUniqueIdentifiers();
         statInfo2 = pop3Protocol2.status();
-        assertEquals(msgCount, listEntries2.length);
-        assertEquals(msgCount, uidlEntries2.length);
-        assertEquals(msgCount, statInfo2.number);
+        assertThat(listEntries2.length).isEqualTo(msgCount);
+        assertThat(uidlEntries2.length).isEqualTo(msgCount);
+        assertThat(statInfo2.number).isEqualTo(msgCount);
 
         // This both should error and so return null
         assertThat(pop3Protocol2.retrieveMessageTop(1, 100)).isNull();
@@ -562,7 +557,7 @@ public class POP3ServerTest {
         usersRepository.addUser("foo", pass);
 
         pop3Client.login("foo", pass);
-        assertEquals(1, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(1);
         assertThat(POP3BeforeSMTPHelper.isAuthorized("127.0.0.1")).isTrue();
 
     }
@@ -578,7 +573,7 @@ public class POP3ServerTest {
         String pass = "password";
         usersRepository.addUser("foo", pass);
 
-        assertEquals(POP3Reply.OK, pop3Client.sendCommand("CAPA"));
+        assertThat(pop3Client.sendCommand("CAPA")).isEqualTo(POP3Reply.OK);
 
         pop3Client.getAdditionalReply();
         pop3Client.getReplyString();
@@ -587,7 +582,7 @@ public class POP3ServerTest {
         assertThat(replies.contains("USER")).describedAs("contains USER").isTrue();
 
         pop3Client.login("foo", pass);
-        assertEquals(POP3Reply.OK, pop3Client.sendCommand("CAPA"));
+        assertThat(pop3Client.sendCommand("CAPA")).isEqualTo(POP3Reply.OK);
 
         pop3Client.getAdditionalReply();
         pop3Client.getReplyString();
@@ -677,13 +672,13 @@ public class POP3ServerTest {
         mailboxManager.startProcessingRequest(session);
 
         pop3Client.login("foo6", "bar6");
-        assertEquals(1, pop3Client.getState());
+        assertThat(pop3Client.getState()).isEqualTo(1);
 
         POP3MessageInfo[] entries = pop3Client.listMessages();
 
         assertThat(entries).isNotNull();
-        assertEquals(1, entries.length);
-        assertEquals(1, pop3Client.getState());
+        assertThat(entries.length).isEqualTo(1);
+        assertThat(pop3Client.getState()).isEqualTo(1);
 
         Reader r = pop3Client.retrieveMessage(entries[0].number);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SPFHandlerTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SPFHandlerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SPFHandlerTest.java
index 9c81ad9..04481cd 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SPFHandlerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SPFHandlerTest.java
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.smtpserver;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -176,8 +176,8 @@ public class SPFHandlerTest {
 
         spf.setDNSService(mockedDnsService);
 
-        assertEquals("declined", HookReturnCode.declined(), spf.doMail(mockedSMTPSession, sender).getResult());
-        assertEquals("declined", HookReturnCode.declined(), spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
+        assertThat(spf.doMail(mockedSMTPSession, sender).getResult()).describedAs("declined").isEqualTo(HookReturnCode.declined());
+        assertThat(spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult()).describedAs("declined").isEqualTo(HookReturnCode.declined());
     }
 
     @Test
@@ -189,8 +189,8 @@ public class SPFHandlerTest {
 
         spf.setDNSService(mockedDnsService);
 
-        assertEquals("declined", HookReturnCode.declined(), spf.doMail(mockedSMTPSession, sender).getResult());
-        assertEquals("fail", HookReturnCode.deny(), spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
+        assertThat(spf.doMail(mockedSMTPSession, sender).getResult()).describedAs("declined").isEqualTo(HookReturnCode.declined());
+        assertThat(spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult()).describedAs("fail").isEqualTo(HookReturnCode.deny());
     }
 
     @Test
@@ -202,9 +202,8 @@ public class SPFHandlerTest {
 
         spf.setDNSService(mockedDnsService);
 
-        assertEquals("declined", HookReturnCode.declined(), spf.doMail(mockedSMTPSession, sender).getResult());
-        assertEquals("softfail declined", HookReturnCode.declined(),
-                spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
+        assertThat(spf.doMail(mockedSMTPSession, sender).getResult()).describedAs("declined").isEqualTo(HookReturnCode.declined());
+        assertThat(spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult()).describedAs("softfail declined").isEqualTo(HookReturnCode.declined());
     }
 
     @Test
@@ -219,8 +218,8 @@ public class SPFHandlerTest {
 
         spf.setBlockSoftFail(true);
 
-        assertEquals("declined", HookReturnCode.declined(), spf.doMail(mockedSMTPSession, sender).getResult());
-        assertEquals("softfail reject", HookReturnCode.deny(), spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
+        assertThat(spf.doMail(mockedSMTPSession, sender).getResult()).describedAs("declined").isEqualTo(HookReturnCode.declined());
+        assertThat(spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult()).describedAs("softfail reject").isEqualTo(HookReturnCode.deny());
     }
 
     @Test
@@ -235,8 +234,8 @@ public class SPFHandlerTest {
 
         spf.setBlockSoftFail(true);
 
-        assertEquals("declined", HookReturnCode.declined(), spf.doMail(mockedSMTPSession, sender).getResult());
-        assertEquals("permerror reject", HookReturnCode.deny(), spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
+        assertThat(spf.doMail(mockedSMTPSession, sender).getResult()).describedAs("declined").isEqualTo(HookReturnCode.declined());
+        assertThat(spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult()).describedAs("permerror reject").isEqualTo(HookReturnCode.deny());
     }
 
     @Test
@@ -250,9 +249,8 @@ public class SPFHandlerTest {
 
         spf.setDNSService(mockedDnsService);
 
-        assertEquals("declined", HookReturnCode.declined(), spf.doMail(mockedSMTPSession, sender).getResult());
-        assertEquals("temperror denysoft", HookReturnCode.denySoft(),
-                spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
+        assertThat(spf.doMail(mockedSMTPSession, sender).getResult()).describedAs("declined").isEqualTo(HookReturnCode.declined());
+        assertThat(spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult()).describedAs("temperror denysoft").isEqualTo(HookReturnCode.denySoft());
     }
 
     @Test
@@ -265,8 +263,8 @@ public class SPFHandlerTest {
 
         spf.setDNSService(mockedDnsService);
 
-        assertEquals("declined", HookReturnCode.declined(), spf.doMail(mockedSMTPSession, sender).getResult());
-        assertEquals("declined", HookReturnCode.declined(), spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
+        assertThat(spf.doMail(mockedSMTPSession, sender).getResult()).describedAs("declined").isEqualTo(HookReturnCode.declined());
+        assertThat(spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult()).describedAs("declined").isEqualTo(HookReturnCode.declined());
     }
 
     @Test
@@ -280,7 +278,7 @@ public class SPFHandlerTest {
 
         spf.setBlockPermError(false);
 
-        assertEquals("declined", HookReturnCode.declined(), spf.doMail(mockedSMTPSession, sender).getResult());
-        assertEquals("declined", HookReturnCode.declined(), spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
+        assertThat(spf.doMail(mockedSMTPSession, sender).getResult()).describedAs("declined").isEqualTo(HookReturnCode.declined());
+        assertThat(spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult()).describedAs("declined").isEqualTo(HookReturnCode.declined());
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java
index 4709d1d..e79e909 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.smtpserver;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
@@ -82,7 +82,7 @@ public class SetMimeHeaderHandlerTest {
         header.setHeaderValue(HEADER_VALUE);
         header.onMessage(mockedSMTPSession, mockedMail);
 
-        assertEquals(HEADER_VALUE, mockedMail.getMessage().getHeader(HEADER_NAME)[0]);
+        assertThat(mockedMail.getMessage().getHeader(HEADER_NAME)[0]).isEqualTo(HEADER_VALUE);
     }
 
     // test if the Header was replaced
@@ -100,6 +100,6 @@ public class SetMimeHeaderHandlerTest {
         header.setHeaderValue(HEADER_VALUE);
         header.onMessage(mockedSMTPSession, mockedMail);
 
-        assertEquals(HEADER_VALUE, mockedMail.getMessage().getHeader(HEADER_NAME)[0]);
+        assertThat(mockedMail.getMessage().getHeader(HEADER_NAME)[0]).isEqualTo(HEADER_VALUE);
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
index 7bcd836..eb56867 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
@@ -20,7 +20,6 @@ package org.apache.james.smtpserver;
 
 import static org.apache.james.spamassassin.SpamAssassinResult.STATUS_MAIL_ATTRIBUTE_NAME;
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
 
 import java.util.HashMap;
 
@@ -120,8 +119,8 @@ public class SpamAssassinHandlerTest {
         handler.setSpamdRejectionHits(200.0);
         HookResult response = handler.onMessage(session, mockedMail);
 
-        assertEquals("Email was not rejected", response.getResult(), HookReturnCode.declined());
-        assertEquals("email was not spam", mockedMail.getAttribute(SpamAssassinResult.FLAG_MAIL_ATTRIBUTE_NAME), "NO");
+        assertThat(HookReturnCode.declined()).describedAs("Email was not rejected").isEqualTo(response.getResult());
+        assertThat("NO").describedAs("email was not spam").isEqualTo(mockedMail.getAttribute(SpamAssassinResult.FLAG_MAIL_ATTRIBUTE_NAME));
         assertThat(mockedMail.getAttribute(STATUS_MAIL_ATTRIBUTE_NAME)).withFailMessage("spam hits").isNotNull();
 
     }
@@ -137,8 +136,8 @@ public class SpamAssassinHandlerTest {
         handler.setSpamdRejectionHits(2000.0);
         HookResult response = handler.onMessage(session, mockedMail);
 
-        assertEquals("Email was not rejected", response.getResult(), HookReturnCode.declined());
-        assertEquals("email was spam", mockedMail.getAttribute(SpamAssassinResult.FLAG_MAIL_ATTRIBUTE_NAME), "YES");
+        assertThat(HookReturnCode.declined()).describedAs("Email was not rejected").isEqualTo(response.getResult());
+        assertThat("YES").describedAs("email was spam").isEqualTo(mockedMail.getAttribute(SpamAssassinResult.FLAG_MAIL_ATTRIBUTE_NAME));
         assertThat(mockedMail.getAttribute(STATUS_MAIL_ATTRIBUTE_NAME)).withFailMessage("spam hits").isNotNull();
     }
 
@@ -153,8 +152,8 @@ public class SpamAssassinHandlerTest {
         handler.setSpamdRejectionHits(200.0);
         HookResult response = handler.onMessage(session, mockedMail);
 
-        assertEquals("Email was rejected", response.getResult(), HookReturnCode.deny());
-        assertEquals("email was spam", mockedMail.getAttribute(SpamAssassinResult.FLAG_MAIL_ATTRIBUTE_NAME), "YES");
+        assertThat(HookReturnCode.deny()).describedAs("Email was rejected").isEqualTo(response.getResult());
+        assertThat("YES").describedAs("email was spam").isEqualTo(mockedMail.getAttribute(SpamAssassinResult.FLAG_MAIL_ATTRIBUTE_NAME));
         assertThat(mockedMail.getAttribute(STATUS_MAIL_ATTRIBUTE_NAME)).withFailMessage("spam hits").isNotNull();
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java
index f098c48..93edf95 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.smtpserver;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.IOException;
 import java.net.InetAddress;
@@ -170,7 +170,7 @@ public class URIRBLHandlerTest {
         handler.setUriRblServer(servers);
         HookResult response = handler.onMessage(session, mockedMail);
 
-        assertEquals("Email was not rejected", response.getResult(), HookReturnCode.declined());
+        assertThat(HookReturnCode.declined()).describedAs("Email was not rejected").isEqualTo(response.getResult());
     }
 
     @Test
@@ -188,7 +188,7 @@ public class URIRBLHandlerTest {
         handler.setUriRblServer(servers);
         HookResult response = handler.onMessage(session, mockedMail);
 
-        assertEquals("Email was rejected", response.getResult(), HookReturnCode.deny());
+        assertThat(HookReturnCode.deny()).describedAs("Email was rejected").isEqualTo(response.getResult());
     }
 
     @Test
@@ -206,7 +206,7 @@ public class URIRBLHandlerTest {
         handler.setUriRblServer(servers);
         HookResult response = handler.onMessage(session, mockedMail);
 
-        assertEquals("Email was rejected", response.getResult(), HookReturnCode.deny());
+        assertThat(HookReturnCode.deny()).describedAs("Email was rejected").isEqualTo(response.getResult());
     }
 
     /*

http://git-wip-us.apache.org/repos/asf/james-project/blob/491e8642/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java
index fa4c09e..730460f 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.james.smtpserver;
 
-import static org.junit.Assert.assertEquals;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.util.HashMap;
 
@@ -85,6 +85,6 @@ public class ValidRcptMXTest {
         handler.setBannedNetworks(ImmutableList.of(bannedAddress), dns);
         HookReturnCode rCode = handler.doRcpt(session, null, mailAddress).getResult();
 
-        assertEquals("Reject", rCode, HookReturnCode.deny());
+        assertThat(HookReturnCode.deny()).describedAs("Reject").isEqualTo(rCode);
     }
 }


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