You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rc...@apache.org on 2020/08/10 02:47:53 UTC

[james-project] 23/23: [Refactoring] Migrate james-server-mailets to JUnit 5

This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 1c4fb2125cbef7e9ed274f7f3f6ce3a29df437a9
Author: Gautier DI FOLCO <gd...@linagora.com>
AuthorDate: Tue Jul 28 14:50:59 2020 +0200

    [Refactoring] Migrate james-server-mailets to JUnit 5
---
 .../apache/james/transport/mailets/BounceTest.java |  34 ++--
 .../james/transport/mailets/DSNBounceTest.java     |  64 ++++----
 .../james/transport/mailets/ForwardTest.java       |  58 ++++---
 .../james/transport/mailets/MetricsMailetTest.java |  24 ++-
 .../transport/mailets/NotifyPostmasterTest.java    |  36 ++---
 .../james/transport/mailets/NotifySenderTest.java  |  38 ++---
 .../james/transport/mailets/RedirectTest.java      |  97 ++++++------
 .../apache/james/transport/mailets/ResendTest.java |  28 ++--
 .../james/transport/mailets/ToRepositoryTest.java  |  34 ++--
 .../mailets/redirect/AddressExtractorTest.java     | 118 +++++++-------
 .../mailets/redirect/MailModifierTest.java         |  44 +++---
 .../mailets/redirect/MessageAlteringUtilsTest.java |  36 ++---
 .../mailets/remote/delivery/DelayTest.java         |  67 ++++----
 .../remote/delivery/DelaysAndMaxRetryTest.java     |  41 +++--
 .../remote/delivery/DeliveryRunnableTest.java      |  41 +++--
 .../remote/delivery/HeloNameProviderTest.java      |  27 ++--
 .../delivery/InternetAddressConverterTest.java     |  21 +--
 .../delivery/RemoteDeliveryConfigurationTest.java  | 173 ++++++++++-----------
 .../mailets/remote/delivery/RepeatTest.java        |  20 +--
 .../james/transport/util/MailAddressUtilsTest.java |  58 ++++---
 .../transport/util/SpecialAddressesUtilsTest.java  |  98 ++++++------
 21 files changed, 532 insertions(+), 625 deletions(-)

diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/BounceTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/BounceTest.java
index b001761..929777c 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/BounceTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/BounceTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -35,23 +36,18 @@ import org.apache.mailet.base.MailAddressFixture;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class BounceTest {
 
     private static final String MAILET_NAME = "mailetName";
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private Bounce bounce;
     private FakeMailContext fakeMailContext;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         DNSService dnsService = mock(DNSService.class);
         bounce = new Bounce(dnsService);
         fakeMailContext = FakeMailContext.defaultContext();
@@ -60,24 +56,24 @@ public class BounceTest {
     }
 
     @Test
-    public void getMailetInfoShouldReturnValue() {
+    void getMailetInfoShouldReturnValue() {
         assertThat(bounce.getMailetInfo()).isEqualTo("Bounce Mailet");
     }
 
     @Test
-    public void initShouldThrowWhenUnkownParameter() throws Exception {
+    void initShouldThrowWhenUnkownParameter() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
                 .setProperty("unknown", "error")
                 .build();
-        expectedException.expect(MessagingException.class);
 
-        bounce.init(mailetConfig);
+        assertThatThrownBy(() -> bounce.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void initShouldNotThrowWhenEveryParameters() throws Exception {
+    void initShouldNotThrowWhenEveryParameters() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -98,7 +94,7 @@ public class BounceTest {
     }
 
     @Test
-    public void bounceShouldReturnAMailToTheSenderWithoutAttributes() throws Exception {
+    void bounceShouldReturnAMailToTheSenderWithoutAttributes() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -124,7 +120,7 @@ public class BounceTest {
     }
 
     @Test
-    public void bounceShouldNotSendEmailToNullSender() throws Exception {
+    void bounceShouldNotSendEmailToNullSender() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -145,7 +141,7 @@ public class BounceTest {
     }
 
     @Test
-    public void bounceShouldChangeTheStateWhenNoSenderAndPassThroughEqualsFalse() throws Exception {
+    void bounceShouldChangeTheStateWhenNoSenderAndPassThroughEqualsFalse() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -166,7 +162,7 @@ public class BounceTest {
     }
 
     @Test
-    public void bounceShouldNotChangeTheStateWhenNoSenderAndPassThroughEqualsTrue() throws Exception {
+    void bounceShouldNotChangeTheStateWhenNoSenderAndPassThroughEqualsTrue() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -189,7 +185,7 @@ public class BounceTest {
     }
 
     @Test
-    public void bounceShouldAddPrefixToSubjectWhenPrefixIsConfigured() throws Exception {
+    void bounceShouldAddPrefixToSubjectWhenPrefixIsConfigured() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
index 176eb605..429dbf6 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/DSNBounceTest.java
@@ -21,6 +21,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -52,25 +53,20 @@ import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailContext.SentMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class DSNBounceTest {
 
     private static final String MAILET_NAME = "mailetName";
     private static final Attribute DELIVERY_ERROR_ATTRIBUTE = Attribute.convertToAttribute("delivery-error", "Delivery error");
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private DSNBounce dsnBounce;
     private FakeMailContext fakeMailContext;
     private MailAddress postmaster;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         postmaster = new MailAddress("postmaster@domain.com");
         
         DNSService dnsService = mock(DNSService.class);
@@ -85,45 +81,45 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void getMailetInfoShouldReturnValue() {
+    void getMailetInfoShouldReturnValue() {
         assertThat(dsnBounce.getMailetInfo()).isEqualTo("DSNBounce Mailet");
     }
 
     @Test
-    public void getAllowedInitParametersShouldReturnTheParameters() {
+    void getAllowedInitParametersShouldReturnTheParameters() {
         assertThat(dsnBounce.getAllowedInitParameters()).containsOnly("debug", "passThrough", "messageString", "attachment", "sender", "prefix");
     }
 
     @Test
-    public void initShouldFailWhenUnknownParameterIsConfigured() throws Exception {
+    void initShouldFailWhenUnknownParameterIsConfigured() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
                 .setProperty("unknwon", "value")
                 .build();
-        expectedException.expect(MessagingException.class);
 
-        dsnBounce.init(mailetConfig);
+        assertThatThrownBy(() -> dsnBounce.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getRecipientsShouldReturnReversePathOnly() {
+    void getRecipientsShouldReturnReversePathOnly() {
         assertThat(dsnBounce.getRecipients()).containsOnly(SpecialAddress.REVERSE_PATH);
     }
 
     @Test
-    public void getToShouldReturnReversePathOnly() {
+    void getToShouldReturnReversePathOnly() {
         assertThat(dsnBounce.getTo()).containsOnly(SpecialAddress.REVERSE_PATH.toInternetAddress());
     }
 
     @Test
-    public void getReversePathShouldReturnNullSpecialAddress() {
+    void getReversePathShouldReturnNullSpecialAddress() {
         Mail mail = null;
         assertThat(dsnBounce.getReversePath(mail)).contains(SpecialAddress.NULL);
     }
 
     @Test
-    public void serviceShouldSendMultipartMailToTheSender() throws Exception {
+    void serviceShouldSendMultipartMailToTheSender() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -153,7 +149,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void serviceShouldSendMultipartMailContainingTextPart() throws Exception {
+    void serviceShouldSendMultipartMailContainingTextPart() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -193,7 +189,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void serviceShouldSendMultipartMailContainingTextPartWhenCustomMessageIsConfigured() throws Exception {
+    void serviceShouldSendMultipartMailContainingTextPartWhenCustomMessageIsConfigured() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -233,7 +229,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void serviceShouldSendMultipartMailContainingDSNPart() throws Exception {
+    void serviceShouldSendMultipartMailContainingDSNPart() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -273,7 +269,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void serviceShouldUpdateTheMailStateWhenNoSenderAndPassThroughIsFalse() throws Exception {
+    void serviceShouldUpdateTheMailStateWhenNoSenderAndPassThroughIsFalse() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -297,7 +293,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void serviceShouldNotUpdateTheMailStateWhenNoSenderPassThroughHasDefaultValue() throws Exception {
+    void serviceShouldNotUpdateTheMailStateWhenNoSenderPassThroughHasDefaultValue() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -320,7 +316,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void serviceShouldNotUpdateTheMailStateWhenNoSenderPassThroughIsTrue() throws Exception {
+    void serviceShouldNotUpdateTheMailStateWhenNoSenderPassThroughIsTrue() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -344,7 +340,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void serviceShouldNotAttachTheOriginalMailWhenAttachmentIsEqualToNone() throws Exception {
+    void serviceShouldNotAttachTheOriginalMailWhenAttachmentIsEqualToNone() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -375,7 +371,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void serviceShouldAttachTheOriginalMailWhenAttachmentIsEqualToAll() throws Exception {
+    void serviceShouldAttachTheOriginalMailWhenAttachmentIsEqualToAll() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -412,7 +408,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void serviceShouldAttachTheOriginalMailHeadersOnlyWhenAttachmentIsEqualToHeads() throws Exception {
+    void serviceShouldAttachTheOriginalMailHeadersOnlyWhenAttachmentIsEqualToHeads() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -450,7 +446,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void serviceShouldSetTheDateHeaderWhenNone() throws Exception {
+    void serviceShouldSetTheDateHeaderWhenNone() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -479,7 +475,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void serviceShouldNotModifyTheDateHeaderWhenAlreadyPresent() throws Exception {
+    void serviceShouldNotModifyTheDateHeaderWhenAlreadyPresent() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -510,7 +506,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void dsnBounceShouldAddPrefixToSubjectWhenPrefixIsConfigured() throws Exception {
+    void dsnBounceShouldAddPrefixToSubjectWhenPrefixIsConfigured() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -532,7 +528,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void dsnBounceShouldAllowSenderSpecialPostmaster() throws Exception {
+    void dsnBounceShouldAllowSenderSpecialPostmaster() throws Exception {
         
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
@@ -560,7 +556,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void dsnBounceShouldAllowSenderSpecialSender() throws Exception {
+    void dsnBounceShouldAllowSenderSpecialSender() throws Exception {
 
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
@@ -588,7 +584,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void dsnBounceShouldAllowSenderSpecialUnaltered() throws Exception {
+    void dsnBounceShouldAllowSenderSpecialUnaltered() throws Exception {
 
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
@@ -615,7 +611,7 @@ public class DSNBounceTest {
     }
 
     @Test
-    public void dsnBounceShouldAllowSenderSpecialAddress() throws Exception {
+    void dsnBounceShouldAllowSenderSpecialAddress() throws Exception {
 
         MailAddress bounceSender = new MailAddress("bounces@domain.com");
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java
index 15fa49c..b357c24 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ForwardTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -35,24 +36,19 @@ import org.apache.mailet.base.MailAddressFixture;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class ForwardTest {
 
     private static final String MAILET_NAME = "mailetName";
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private Forward forward;
     private FakeMailContext fakeMailContext;
     private MailAddress postmaster;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         DNSService dnsService = mock(DNSService.class);
         forward = new Forward(dnsService);
         postmaster = new MailAddress("postmaster@james.org");
@@ -64,24 +60,24 @@ public class ForwardTest {
     }
 
     @Test
-    public void getMailetInfoShouldReturnValue() {
+    void getMailetInfoShouldReturnValue() {
         assertThat(forward.getMailetInfo()).isEqualTo("Forward Mailet");
     }
 
     @Test
-    public void initShouldThrowWhenUnkownParameter() throws Exception {
+    void initShouldThrowWhenUnkownParameter() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
                 .setProperty("unknown", "error")
                 .build();
-        expectedException.expect(MessagingException.class);
 
-        forward.init(mailetConfig);
+        assertThatThrownBy(() -> forward.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void initShouldNotThrowWhenEveryParameters() throws Exception {
+    void initShouldNotThrowWhenEveryParameters() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -96,65 +92,65 @@ public class ForwardTest {
     }
 
     @Test
-    public void initShouldThrowWhenNoForwardToParameters() throws Exception {
+    void initShouldThrowWhenNoForwardToParameters() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
                 .setProperty("isStatic", "true")
                 .build();
-        expectedException.expect(MessagingException.class);
 
-        forward.init(mailetConfig);
+        assertThatThrownBy(() -> forward.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void initShouldThrowWhenUnparsableForwardToAddress() throws Exception {
+    void initShouldThrowWhenUnparsableForwardToAddress() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
                 .setProperty("isStatic", "true")
                 .setProperty("forwardTo", "user@james@org")
                 .build();
-        expectedException.expect(MessagingException.class);
 
-        forward.init(mailetConfig);
+        assertThatThrownBy(() -> forward.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void initShouldThrowWhenForwardToIsEmpty() throws Exception {
+    void initShouldThrowWhenForwardToIsEmpty() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
                 .setProperty("isStatic", "true")
                 .setProperty("forwardTo", "")
                 .build();
-        expectedException.expect(MessagingException.class);
 
-        forward.init(mailetConfig);
+        assertThatThrownBy(() -> forward.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getToShouldReturnEmpty() throws Exception {
+    void getToShouldReturnEmpty() throws Exception {
         assertThat(forward.getTo()).isEmpty();
     }
 
     @Test
-    public void getReplyToShouldReturnNull() throws Exception {
+    void getReplyToShouldReturnNull() throws Exception {
         assertThat(forward.getReplyTo()).isEmpty();
     }
 
     @Test
-    public void getReversePathShouldReturnAbsent() throws Exception {
+    void getReversePathShouldReturnAbsent() throws Exception {
         assertThat(forward.getReversePath()).isEmpty();
     }
 
     @Test
-    public void getSenderShouldReturnAbsent() throws Exception {
+    void getSenderShouldReturnAbsent() throws Exception {
         assertThat(forward.getSender()).isEmpty();
     }
 
     @Test
-    public void getRecipientsShouldReturnRecipientsWhenForwardtoParameters() throws Exception {
+    void getRecipientsShouldReturnRecipientsWhenForwardtoParameters() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -170,7 +166,7 @@ public class ForwardTest {
     }
 
     @Test
-    public void getRecipientsShouldReturnRecipientsWhenForwardToParameters() throws Exception {
+    void getRecipientsShouldReturnRecipientsWhenForwardToParameters() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -186,7 +182,7 @@ public class ForwardTest {
     }
 
     @Test
-    public void getRecipientsShouldReturnSpecialAddressWhenForwardToIsMatchingOne() throws Exception {
+    void getRecipientsShouldReturnSpecialAddressWhenForwardToIsMatchingOne() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -198,7 +194,7 @@ public class ForwardTest {
     }
 
     @Test
-    public void forwardShouldNotModifySubject() throws Exception {
+    void forwardShouldNotModifySubject() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/MetricsMailetTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/MetricsMailetTest.java
index 797a495..9803e0c 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/MetricsMailetTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/MetricsMailetTest.java
@@ -20,40 +20,38 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import javax.mail.MessagingException;
 
 import org.apache.james.metrics.tests.RecordingMetricFactory;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class MetricsMailetTest {
 
     public static final String MAILET_NAME = "Metric test";
     public static final String METRIC_NAME = "metricName";
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
 
     private RecordingMetricFactory metricFactory;
     private MetricsMailet mailet;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() {
         metricFactory = new RecordingMetricFactory();
         mailet = new MetricsMailet(metricFactory);
     }
 
     @Test
-    public void initShouldThrowWhenMetricNameIsNotGiven() throws Exception {
-        expectedException.expect(NullPointerException.class);
-
-        mailet.init(FakeMailetConfig.builder().mailetName(MAILET_NAME).build());
+    void initShouldThrowWhenMetricNameIsNotGiven() {
+        assertThatThrownBy(() -> mailet.init(FakeMailetConfig.builder().mailetName(MAILET_NAME).build()))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void serviceShouldIncrementMetricCounter() throws Exception {
+    void serviceShouldIncrementMetricCounter() throws Exception {
         mailet.init(FakeMailetConfig.builder()
             .mailetName(MAILET_NAME)
             .setProperty(MetricsMailet.METRIC_NAME, METRIC_NAME)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
index 64c4174..f2c12b6 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -35,24 +36,19 @@ import org.apache.mailet.base.MailAddressFixture;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class NotifyPostmasterTest {
 
     private static final String MAILET_NAME = "mailetName";
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private NotifyPostmaster notifyPostmaster;
     private MailAddress postmaster;
     private FakeMailContext fakeMailContext;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         DNSService dnsService = mock(DNSService.class);
         notifyPostmaster = new NotifyPostmaster(dnsService);
         postmaster = new MailAddress("postmaster@james.org");
@@ -64,29 +60,29 @@ public class NotifyPostmasterTest {
     }
 
     @Test
-    public void getMailetInfoShouldReturnValue() {
+    void getMailetInfoShouldReturnValue() {
         assertThat(notifyPostmaster.getMailetInfo()).isEqualTo("NotifyPostmaster Mailet");
     }
 
     @Test
-    public void getAllowedInitParametersShouldReturnTheParameters() {
+    void getAllowedInitParametersShouldReturnTheParameters() {
         assertThat(notifyPostmaster.getAllowedInitParameters()).containsOnly("debug", "passThrough", "fakeDomainCheck", "inline", "attachment", "message", "notice", "sender", "sendingAddress", "prefix", "attachError", "to");
     }
 
     @Test
-    public void initShouldFailWhenUnknownParameterIsConfigured() throws Exception {
+    void initShouldFailWhenUnknownParameterIsConfigured() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
                 .setProperty("unknwon", "value")
                 .build();
-        expectedException.expect(MessagingException.class);
 
-        notifyPostmaster.init(mailetConfig);
+        assertThatThrownBy(() -> notifyPostmaster.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getRecipientsShouldReturnPostmaster() throws Exception {
+    void getRecipientsShouldReturnPostmaster() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -97,7 +93,7 @@ public class NotifyPostmasterTest {
     }
 
     @Test
-    public void getToShouldReturnPostmasterWhenToIsNotconfigured() throws Exception {
+    void getToShouldReturnPostmasterWhenToIsNotconfigured() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -108,7 +104,7 @@ public class NotifyPostmasterTest {
     }
 
     @Test
-    public void getToShouldReturnPostmasterWhenToIsEqualToPostmaster() throws Exception {
+    void getToShouldReturnPostmasterWhenToIsEqualToPostmaster() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -120,7 +116,7 @@ public class NotifyPostmasterTest {
     }
 
     @Test
-    public void getToShouldReturnUnalteredWhenToIsEqualToUnaltered() throws Exception {
+    void getToShouldReturnUnalteredWhenToIsEqualToUnaltered() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -132,7 +128,7 @@ public class NotifyPostmasterTest {
     }
 
     @Test
-    public void getToShouldReturnPostmasterWhenToIsNotEqualToPostmasterOrUnaltered() throws Exception {
+    void getToShouldReturnPostmasterWhenToIsNotEqualToPostmasterOrUnaltered() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -144,7 +140,7 @@ public class NotifyPostmasterTest {
     }
 
     @Test
-    public void notifyPostmasterShouldAddPrefixToSubjectWhenPrefixIsConfigured() throws Exception {
+    void notifyPostmasterShouldAddPrefixToSubjectWhenPrefixIsConfigured() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
index ddf83e9..36ad41e 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -35,23 +36,18 @@ import org.apache.mailet.base.MailAddressFixture;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class NotifySenderTest {
 
     private static final String MAILET_NAME = "mailetName";
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private NotifySender notifySender;
     private FakeMailContext fakeMailContext;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         DNSService dnsService = mock(DNSService.class);
         notifySender = new NotifySender(dnsService);
         fakeMailContext = FakeMailContext.builder()
@@ -62,29 +58,29 @@ public class NotifySenderTest {
     }
 
     @Test
-    public void getMailetInfoShouldReturnValue() {
+    void getMailetInfoShouldReturnValue() {
         assertThat(notifySender.getMailetInfo()).isEqualTo("NotifySender Mailet");
     }
 
     @Test
-    public void getAllowedInitParametersShouldReturnTheParameters() {
+    void getAllowedInitParametersShouldReturnTheParameters() {
         assertThat(notifySender.getAllowedInitParameters()).containsOnly("debug", "passThrough", "fakeDomainCheck", "inline", "attachment", "message", "notice", "sender", "sendingAddress", "prefix", "attachError", "to");
     }
 
     @Test
-    public void initShouldFailWhenUnknownParameterIsConfigured() throws Exception {
+    void initShouldFailWhenUnknownParameterIsConfigured() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
                 .setProperty("unknwon", "value")
                 .build();
-        expectedException.expect(MessagingException.class);
 
-        notifySender.init(mailetConfig);
+        assertThatThrownBy(() -> notifySender.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getRecipientsShouldReturnSender() throws Exception {
+    void getRecipientsShouldReturnSender() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -95,7 +91,7 @@ public class NotifySenderTest {
     }
 
     @Test
-    public void getToShouldReturnSenderWhenToIsNotconfigured() throws Exception {
+    void getToShouldReturnSenderWhenToIsNotconfigured() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -106,7 +102,7 @@ public class NotifySenderTest {
     }
 
     @Test
-    public void getToShouldReturnSenderWhenToIsEqualToSender() throws Exception {
+    void getToShouldReturnSenderWhenToIsEqualToSender() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -118,7 +114,7 @@ public class NotifySenderTest {
     }
 
     @Test
-    public void getToShouldReturnUnalteredWhenToIsEqualToUnaltered() throws Exception {
+    void getToShouldReturnUnalteredWhenToIsEqualToUnaltered() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -130,7 +126,7 @@ public class NotifySenderTest {
     }
 
     @Test
-    public void getToShouldReturnFromWhenToIsEqualToFrom() throws Exception {
+    void getToShouldReturnFromWhenToIsEqualToFrom() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -142,7 +138,7 @@ public class NotifySenderTest {
     }
 
     @Test
-    public void getToShouldReturnSenderWhenToIsNotEqualToSenderUnalteredOrFrom() throws Exception {
+    void getToShouldReturnSenderWhenToIsNotEqualToSenderUnalteredOrFrom() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -154,7 +150,7 @@ public class NotifySenderTest {
     }
 
     @Test
-    public void notifySenderShouldAddPrefixToSubjectWhenPrefixIsConfigured() throws Exception {
+    void notifySenderShouldAddPrefixToSubjectWhenPrefixIsConfigured() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java
index 4875680..45fddd6 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RedirectTest.java
@@ -20,6 +20,8 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -35,24 +37,19 @@ import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailContext.SentMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class RedirectTest {
 
     private static final String MAILET_NAME = "mailetName";
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private Redirect redirect;
     private FakeMailContext fakeMailContext;
     private MailAddress postmaster;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         DNSService dnsService = mock(DNSService.class);
         redirect = new Redirect(dnsService);
         postmaster = new MailAddress("postmaster@james.org");
@@ -64,24 +61,24 @@ public class RedirectTest {
     }
 
     @Test
-    public void getMailetInfoShouldReturnValue() {
+    void getMailetInfoShouldReturnValue() {
         assertThat(redirect.getMailetInfo()).isEqualTo("Redirect Mailet");
     }
 
     @Test
-    public void initShouldThrowWhenUnkownParameter() throws Exception {
+    void initShouldThrowWhenUnkownParameter() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
                 .setProperty("unknown", "error")
                 .build();
-        expectedException.expect(MessagingException.class);
 
-        redirect.init(mailetConfig);
+        assertThatThrownBy(() -> redirect.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void initShouldNotThrowWhenEveryParameters() throws Exception {
+    void initShouldNotThrowWhenEveryParameters() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -108,7 +105,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void initShouldReturnEmptyWhenNoRecipientsOrToParameters() throws Exception {
+    void initShouldReturnEmptyWhenNoRecipientsOrToParameters() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -119,7 +116,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void getRecipientsShouldThrowWhenUnparsableRecipientsAddress() throws Exception {
+    void getRecipientsShouldThrowWhenUnparsableRecipientsAddress() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -127,12 +124,12 @@ public class RedirectTest {
                 .build();
         redirect.init(mailetConfig);
 
-        expectedException.expect(MessagingException.class);
-        redirect.getRecipients();
+        assertThatThrownBy(() -> redirect.getRecipients())
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getRecipientsShouldThrowWhenUnparsableToAddress() throws Exception {
+    void getRecipientsShouldThrowWhenUnparsableToAddress() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -140,12 +137,12 @@ public class RedirectTest {
                 .build();
         redirect.init(mailetConfig);
 
-        expectedException.expect(MessagingException.class);
-        redirect.getRecipients();
+        assertThatThrownBy(() -> redirect.getRecipients())
+                .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getRecipientsShouldThrowWhenRecipientsAndToAreEmpty() throws Exception {
+    void getRecipientsShouldThrowWhenRecipientsAndToAreEmpty() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -154,12 +151,12 @@ public class RedirectTest {
                 .build();
         redirect.init(mailetConfig);
 
-        expectedException.expect(MessagingException.class);
-        redirect.getRecipients();
+        assertThatThrownBy(() -> redirect.getRecipients())
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getRecipientsShouldReturnSpecialAddressWhenRecipientsIsMatchingOne() throws Exception {
+    void getRecipientsShouldReturnSpecialAddressWhenRecipientsIsMatchingOne() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -171,7 +168,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void getToShouldThrowWhenUnparsableRecipientsAddress() throws Exception {
+    void getToShouldThrowWhenUnparsableRecipientsAddress() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -179,12 +176,12 @@ public class RedirectTest {
                 .build();
         redirect.init(mailetConfig);
 
-        expectedException.expect(MessagingException.class);
-        redirect.getTo();
+        assertThatThrownBy(() -> redirect.getTo())
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getToShouldThrowWhenUnparsableToAddress() throws Exception {
+    void getToShouldThrowWhenUnparsableToAddress() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -192,12 +189,12 @@ public class RedirectTest {
                 .build();
         redirect.init(mailetConfig);
 
-        expectedException.expect(MessagingException.class);
-        redirect.getTo();
+        assertThatThrownBy(() -> redirect.getTo())
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getToShouldThrowWhenRecipientsAndToAreEmpty() throws Exception {
+    void getToShouldThrowWhenRecipientsAndToAreEmpty() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -206,12 +203,12 @@ public class RedirectTest {
                 .build();
         redirect.init(mailetConfig);
 
-        expectedException.expect(MessagingException.class);
-        redirect.getTo();
+        assertThatThrownBy(() -> redirect.getTo())
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getToShouldReturnSpecialAddressWhenRecipientsIsMatchingOne() throws Exception {
+    void getToShouldReturnSpecialAddressWhenRecipientsIsMatchingOne() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -223,7 +220,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void getReversePathShouldReturnAbsentWhenNoReversePathParameter() throws Exception {
+    void getReversePathShouldReturnAbsentWhenNoReversePathParameter() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -234,7 +231,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void getReversePathShouldThrowWhenUnparsableReversePathParameter() throws Exception {
+    void getReversePathShouldThrowWhenUnparsableReversePathParameter() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -242,12 +239,12 @@ public class RedirectTest {
                 .build();
         redirect.init(mailetConfig);
 
-        expectedException.expect(MessagingException.class);
-        redirect.getReversePath();
+        assertThatThrownBy(() -> redirect.getReversePath())
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getReversePathShouldReturnSpecialAddressWhenReversePathIsMatchingOne() throws Exception {
+    void getReversePathShouldReturnSpecialAddressWhenReversePathIsMatchingOne() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -259,7 +256,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void getReversePathShouldReturnMailAddressWhenReversePathIsGiven() throws Exception {
+    void getReversePathShouldReturnMailAddressWhenReversePathIsGiven() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -271,7 +268,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void getReversePathWithMailShouldReturnAbsentWhenNotStaticAndReversePathParameters() throws Exception {
+    void getReversePathWithMailShouldReturnAbsentWhenNotStaticAndReversePathParameters() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -286,7 +283,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void getReversePathWithMailShouldReturnReversePathWhenReversePathIsGiven() throws Exception {
+    void getReversePathWithMailShouldReturnReversePathWhenReversePathIsGiven() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -302,7 +299,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void getReversePathWithMailShouldReturnSpecialAddressWhenReversePathIsMatchingOne() throws Exception {
+    void getReversePathWithMailShouldReturnSpecialAddressWhenReversePathIsMatchingOne() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -318,7 +315,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void getReversePathWithMailShouldReturnSpecialAddressWhenNotStaticAndNewReversePathIsMatchingOne() throws Exception {
+    void getReversePathWithMailShouldReturnSpecialAddressWhenNotStaticAndNewReversePathIsMatchingOne() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -335,7 +332,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void getReversePathWithMailShouldReturnSenderWhenNoReversePath() throws Exception {
+    void getReversePathWithMailShouldReturnSenderWhenNoReversePath() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -351,7 +348,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void redirectShouldNotModifyOriginalSubject() throws Exception {
+    void redirectShouldNotModifyOriginalSubject() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -374,7 +371,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void redirectShouldAddPrefixAndSubjectToSentMail() throws Exception {
+    void redirectShouldAddPrefixAndSubjectToSentMail() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -400,7 +397,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void unalteredShouldPreserveMessageId() throws Exception {
+    void unalteredShouldPreserveMessageId() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName(MAILET_NAME)
             .mailetContext(fakeMailContext)
@@ -427,7 +424,7 @@ public class RedirectTest {
     }
 
     @Test
-    public void alteredShouldResetMessageId() throws Exception {
+    void alteredShouldResetMessageId() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName(MAILET_NAME)
             .mailetContext(fakeMailContext)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
index 7c64751..92b8a4d 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -35,23 +36,18 @@ import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailContext.SentMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class ResendTest {
 
     private static final String MAILET_NAME = "mailetName";
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private Resend resend;
     private FakeMailContext fakeMailContext;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         DNSService dnsService = mock(DNSService.class);
         resend = new Resend(dnsService);
         fakeMailContext = FakeMailContext.builder()
@@ -62,24 +58,24 @@ public class ResendTest {
     }
 
     @Test
-    public void getMailetInfoShouldReturnValue() {
+    void getMailetInfoShouldReturnValue() {
         assertThat(resend.getMailetInfo()).isEqualTo("Redirect Mailet");
     }
 
     @Test
-    public void initShouldThrowWhenUnknownParameter() throws Exception {
+    void initShouldThrowWhenUnknownParameter() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
                 .setProperty("unknown", "error")
                 .build();
-        expectedException.expect(MessagingException.class);
 
-        resend.init(mailetConfig);
+        assertThatThrownBy(() -> resend.init(mailetConfig))
+                .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void initShouldNotThrowWhenEveryParameters() throws Exception {
+    void initShouldNotThrowWhenEveryParameters() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -105,7 +101,7 @@ public class ResendTest {
     }
 
     @Test
-    public void resendShouldNotModifyOriginalSubject() throws Exception {
+    void resendShouldNotModifyOriginalSubject() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
@@ -130,7 +126,7 @@ public class ResendTest {
     }
 
     @Test
-    public void resendShouldAddPrefixAndSubjectToSentMail() throws Exception {
+    void resendShouldAddPrefixAndSubjectToSentMail() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName(MAILET_NAME)
                 .mailetContext(fakeMailContext)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ToRepositoryTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ToRepositoryTest.java
index 6b961b7..7ed4d8b 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ToRepositoryTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ToRepositoryTest.java
@@ -19,6 +19,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
@@ -33,29 +34,26 @@ import org.apache.mailet.MailetConfig;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
 import org.apache.mailet.base.test.MailUtil;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class ToRepositoryTest {
     public static final String REPOSITORY_PATH = "file://var/mail/any";
-    @Rule public ExpectedException expectedException = ExpectedException.none();
-    
+
     private ToRepository mailet;
     private MailRepositoryStore mailRepositoryStore;
     private FakeMail message;
 
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    void setup() throws Exception {
         mailRepositoryStore = mock(MailRepositoryStore.class);
         mailet = new ToRepository(mailRepositoryStore);
         message = MailUtil.createMockMail2Recipients(MailUtil.createMimeMessage());
     }
 
     @Test
-    public void getMailetInfoShouldReturnExpectedContent() {
+    void getMailetInfoShouldReturnExpectedContent() {
         String expected = "ToRepository Mailet";
 
         String actual = mailet.getMailetInfo();
@@ -64,7 +62,7 @@ public class ToRepositoryTest {
     }
 
     @Test
-    public void initShouldNotThrowWhenInvalidPassThrough() throws Exception {
+    void initShouldNotThrowWhenInvalidPassThrough() throws Exception {
         MailetConfig mockedMailetConfig = mock(MailetConfig.class);
         when(mockedMailetConfig.getInitParameter("passThrough")).thenThrow(new RuntimeException());
         when(mockedMailetConfig.getInitParameter("repositoryPath")).thenReturn(REPOSITORY_PATH);
@@ -73,19 +71,19 @@ public class ToRepositoryTest {
     }
 
     @Test
-    public void initShouldThrowWhenMailStoreThrows() throws Exception {
+    void initShouldThrowWhenMailStoreThrows() throws Exception {
         when(mailRepositoryStore.select(any())).thenThrow(new RuntimeException());
-        expectedException.expect(MessagingException.class);
-
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("repositoryPath", REPOSITORY_PATH)
             .build();
-        mailet.init(mailetConfig);
+
+        assertThatThrownBy(() -> mailet.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void serviceShouldStoreMailIntoRepository() throws Exception {
+    void serviceShouldStoreMailIntoRepository() throws Exception {
         MailRepository mailRepository = mock(MailRepository.class);
         when(mailRepositoryStore.select(any())).thenReturn(mailRepository);
 
@@ -101,7 +99,7 @@ public class ToRepositoryTest {
     }
 
     @Test
-    public void serviceShouldGhostMailIfPassThroughNotSet() throws Exception {
+    void serviceShouldGhostMailIfPassThroughNotSet() throws Exception {
         MailRepository mailRepository = mock(MailRepository.class);
         when(mailRepositoryStore.select(any())).thenReturn(mailRepository);
 
@@ -117,7 +115,7 @@ public class ToRepositoryTest {
     }
 
     @Test
-    public void serviceShouldGhostMailIfPassThroughSetToFalse() throws Exception {
+    void serviceShouldGhostMailIfPassThroughSetToFalse() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("passThrough", "false")
@@ -133,7 +131,7 @@ public class ToRepositoryTest {
     }
 
     @Test
-    public void serviceShouldNotGhostMailIfPassThroughSetToTrue() throws Exception {
+    void serviceShouldNotGhostMailIfPassThroughSetToTrue() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("passThrough", "true")
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AddressExtractorTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AddressExtractorTest.java
index 336e2a1..8a36a6b 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AddressExtractorTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/AddressExtractorTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets.redirect;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -30,23 +31,18 @@ import javax.mail.MessagingException;
 
 import org.apache.james.core.MailAddress;
 import org.apache.mailet.MailetContext;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
 public class AddressExtractorTest {
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private MailAddress postmaster;
     private MailetContext mailetContext;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    void setup() throws Exception {
         postmaster = new MailAddress("postmaster", "james.org");
         mailetContext = mock(MailetContext.class);
         when(mailetContext.getPostmaster())
@@ -55,51 +51,51 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void extractShouldThrowWhenMailetContextIsNull() throws Exception {
-        expectedException.expect(NullPointerException.class);
-        AddressExtractor.withContext(null)
-            .extract(Optional.of("user@james.org, user2@james.org"));
+    void extractShouldThrowWhenMailetContextIsNull() {
+        assertThatThrownBy(() -> AddressExtractor.withContext(null)
+                .extract(Optional.of("user@james.org, user2@james.org")))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void extractShouldThrowWhenAllowedSpecialsIsNotGiven() throws Exception {
-        expectedException.expect(NullPointerException.class);
-        AddressExtractor.withContext(mailetContext)
-            .extract(Optional.of("user@james.org, user2@james.org"));
+    void extractShouldThrowWhenAllowedSpecialsIsNotGiven() {
+        assertThatThrownBy(() -> AddressExtractor.withContext(mailetContext)
+                .extract(Optional.of("user@james.org, user2@james.org")))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void extractShouldThrowWhenAllowedSpecialsIsNull() throws Exception {
-        expectedException.expect(NullPointerException.class);
-        AddressExtractor.withContext(mailetContext)
-            .allowedSpecials(null)
-            .extract(Optional.of("user@james.org, user2@james.org"));
+    void extractShouldThrowWhenAllowedSpecialsIsNull() {
+        assertThatThrownBy(() -> AddressExtractor.withContext(mailetContext)
+                .allowedSpecials(null)
+                .extract(Optional.of("user@james.org, user2@james.org")))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void getSpecialAddressShouldThrowWhenMailetContextIsNull() throws Exception {
-        expectedException.expect(NullPointerException.class);
-        AddressExtractor.withContext(null)
-            .getSpecialAddress("user@james.org, user2@james.org");
+    void getSpecialAddressShouldThrowWhenMailetContextIsNull() {
+        assertThatThrownBy(() -> AddressExtractor.withContext(null)
+                .getSpecialAddress("user@james.org, user2@james.org"))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void getSpecialAddressShouldThrowWhenAllowedSpecialsIsNotGiven() throws Exception {
-        expectedException.expect(NullPointerException.class);
-        AddressExtractor.withContext(mailetContext)
-            .getSpecialAddress("user@james.org, user2@james.org");
+    void getSpecialAddressShouldThrowWhenAllowedSpecialsIsNotGiven() {
+        assertThatThrownBy(() -> AddressExtractor.withContext(mailetContext)
+                .getSpecialAddress("user@james.org, user2@james.org"))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void getSpecialAddressShouldThrowWhenAllowedSpecialsIsNull() throws Exception {
-        expectedException.expect(NullPointerException.class);
-        AddressExtractor.withContext(mailetContext)
-            .allowedSpecials(null)
-            .getSpecialAddress("user@james.org, user2@james.org");
+    void getSpecialAddressShouldThrowWhenAllowedSpecialsIsNull() {
+        assertThatThrownBy(() -> AddressExtractor.withContext(mailetContext)
+                .allowedSpecials(null)
+                .getSpecialAddress("user@james.org, user2@james.org"))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void extractShouldReturnEmptyWhenAddressListIsAbsent() throws Exception {
+    void extractShouldReturnEmptyWhenAddressListIsAbsent() throws Exception {
         List<MailAddress> extract = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.<String>of())
                 .extract(Optional.empty());
@@ -108,7 +104,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void extractShouldReturnListWhenParsingSucceed() throws Exception {
+    void extractShouldReturnListWhenParsingSucceed() throws Exception {
         List<MailAddress> extract = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.<String>of())
                 .extract(Optional.of("user@james.org, user2@james.org"));
@@ -118,7 +114,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void extractShouldReturnSpecialAddressesWhenAddressesAreSpecial() throws Exception {
+    void extractShouldReturnSpecialAddressesWhenAddressesAreSpecial() throws Exception {
         List<MailAddress> extract = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.<String>of("postmaster", "to"))
                 .extract(Optional.of("postmaster, to"));
@@ -128,15 +124,15 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void extractShouldThrowWhenParsingFail() throws Exception {
-        expectedException.expect(MessagingException.class);
-        AddressExtractor.withContext(mailetContext)
-            .allowedSpecials(ImmutableList.<String>of())
-            .extract(Optional.of("user@james@org"));
+    void extractShouldThrowWhenParsingFail() {
+        assertThatThrownBy(() -> AddressExtractor.withContext(mailetContext)
+                .allowedSpecials(ImmutableList.<String>of())
+                .extract(Optional.of("user@james@org")))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getSpecialAddressShouldReturnAbsentWhenAddressIsNull() throws Exception {
+    void getSpecialAddressShouldReturnAbsentWhenAddressIsNull() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.<String>of())
                 .getSpecialAddress(null);
@@ -144,7 +140,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldReturnAbsentWhenAddressIsEmpty() throws Exception {
+    void getSpecialAddressShouldReturnAbsentWhenAddressIsEmpty() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.<String>of())
                 .getSpecialAddress("");
@@ -152,7 +148,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldReturnAbsentWhenAddressIsNotSpecial() throws Exception {
+    void getSpecialAddressShouldReturnAbsentWhenAddressIsNotSpecial() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.<String>of())
                 .getSpecialAddress("user@james.org");
@@ -160,7 +156,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldReturnPostmasterWhenAddressMatchesPostmasterSpecialAddress() throws Exception {
+    void getSpecialAddressShouldReturnPostmasterWhenAddressMatchesPostmasterSpecialAddress() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.of("postmaster"))
                 .getSpecialAddress("postmaster");
@@ -168,7 +164,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldReturnSenderWhenAddressMatchesSenderSpecialAddress() throws Exception {
+    void getSpecialAddressShouldReturnSenderWhenAddressMatchesSenderSpecialAddress() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.of("sender"))
                 .getSpecialAddress("sender");
@@ -176,7 +172,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldReturnReversePathWhenAddressMatchesReversePathSpecialAddress() throws Exception {
+    void getSpecialAddressShouldReturnReversePathWhenAddressMatchesReversePathSpecialAddress() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.of("reversepath"))
                 .getSpecialAddress("reversepath");
@@ -184,7 +180,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldReturnFromWhenAddressMatchesFromSpecialAddress() throws Exception {
+    void getSpecialAddressShouldReturnFromWhenAddressMatchesFromSpecialAddress() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.of("from"))
                 .getSpecialAddress("from");
@@ -192,7 +188,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldReturnReplyToWhenAddressMatchesReplyToSpecialAddress() throws Exception {
+    void getSpecialAddressShouldReturnReplyToWhenAddressMatchesReplyToSpecialAddress() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.of("replyto"))
                 .getSpecialAddress("replyto");
@@ -200,7 +196,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldReturnToWhenAddressMatchesToSpecialAddress() throws Exception {
+    void getSpecialAddressShouldReturnToWhenAddressMatchesToSpecialAddress() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.of("to"))
                 .getSpecialAddress("to");
@@ -208,7 +204,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldReturnRecipientsWhenAddressMatchesRecipientsSpecialAddress() throws Exception {
+    void getSpecialAddressShouldReturnRecipientsWhenAddressMatchesRecipientsSpecialAddress() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.of("recipients"))
                 .getSpecialAddress("recipients");
@@ -216,7 +212,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldReturnDeleteWhenAddressMatchesDeleteSpecialAddress() throws Exception {
+    void getSpecialAddressShouldReturnDeleteWhenAddressMatchesDeleteSpecialAddress() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.of("delete"))
                 .getSpecialAddress("delete");
@@ -224,7 +220,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldReturnUnalteredWhenAddressMatchesUnalteredSpecialAddress() throws Exception {
+    void getSpecialAddressShouldReturnUnalteredWhenAddressMatchesUnalteredSpecialAddress() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.of("unaltered"))
                 .getSpecialAddress("unaltered");
@@ -232,7 +228,7 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldReturnNullWhenAddressMatchesNullSpecialAddress() throws Exception {
+    void getSpecialAddressShouldReturnNullWhenAddressMatchesNullSpecialAddress() throws Exception {
         Optional<MailAddress> specialAddress = AddressExtractor.withContext(mailetContext)
                 .allowedSpecials(ImmutableList.of("null"))
                 .getSpecialAddress("null");
@@ -240,10 +236,10 @@ public class AddressExtractorTest {
     }
 
     @Test
-    public void getSpecialAddressShouldThrowWhenSpecialAddressNotAllowed() throws Exception {
-        expectedException.expect(MessagingException.class);
-        AddressExtractor.withContext(mailetContext)
-            .allowedSpecials(ImmutableList.<String>of("notallowed"))
-            .getSpecialAddress("postmaster");
+    void getSpecialAddressShouldThrowWhenSpecialAddressNotAllowed() {
+        assertThatThrownBy(() -> AddressExtractor.withContext(mailetContext)
+                .allowedSpecials(ImmutableList.<String>of("notallowed"))
+                .getSpecialAddress("postmaster"))
+            .isInstanceOf(MessagingException.class);
     }
 }
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MailModifierTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MailModifierTest.java
index d04ba88..d15d6f2 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MailModifierTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MailModifierTest.java
@@ -18,47 +18,43 @@
  ****************************************************************/
 package org.apache.james.transport.mailets.redirect;
 
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.server.core.MailImpl;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 public class MailModifierTest {
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     @Test
-    public void buildShouldThrowWhenMailetIsNull() {
-        expectedException.expect(NullPointerException.class);
-        expectedException.expectMessage("'mailet' is mandatory");
-        MailModifier.builder().build();
+    void buildShouldThrowWhenMailetIsNull() {
+        assertThatThrownBy(() -> MailModifier.builder().build())
+            .isInstanceOf(NullPointerException.class)
+            .hasMessage("'mailet' is mandatory");
     }
 
     @Test
-    public void buildShouldThrowWhenMailIsNull() {
-        expectedException.expect(NullPointerException.class);
-        expectedException.expectMessage("'mail' is mandatory");
-        MailModifier.builder()
-            .mailet(mock(RedirectNotify.class))
-            .build();
+    void buildShouldThrowWhenMailIsNull() {
+        assertThatThrownBy(() -> MailModifier.builder()
+                .mailet(mock(RedirectNotify.class))
+                .build())
+            .isInstanceOf(NullPointerException.class)
+            .hasMessage("'mail' is mandatory");
     }
 
     @Test
-    public void buildShouldThrowWhenDNSIsNull() {
-        expectedException.expect(NullPointerException.class);
-        expectedException.expectMessage("'dns' is mandatory");
-        MailModifier.builder()
-            .mailet(mock(RedirectNotify.class))
-            .mail(mock(MailImpl.class))
-            .build();
+    void buildShouldThrowWhenDNSIsNull() {
+        assertThatThrownBy(() -> MailModifier.builder()
+                .mailet(mock(RedirectNotify.class))
+                .mail(mock(MailImpl.class))
+                .build())
+            .isInstanceOf(NullPointerException.class)
+            .hasMessage("'dns' is mandatory");
     }
 
     @Test
-    public void buildShouldWorkWhenEverythingProvided() {
+    void buildShouldWorkWhenEverythingProvided() {
         MailModifier.builder()
             .mailet(mock(RedirectNotify.class))
             .mail(mock(MailImpl.class))
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MessageAlteringUtilsTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MessageAlteringUtilsTest.java
index 248f31a..9b7da2a 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MessageAlteringUtilsTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MessageAlteringUtilsTest.java
@@ -19,42 +19,38 @@
 package org.apache.james.transport.mailets.redirect;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 
 import org.apache.mailet.Mail;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 public class MessageAlteringUtilsTest {
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     @Test
-    public void buildShouldThrowWhenMailetIsNull() {
-        expectedException.expect(NullPointerException.class);
-        expectedException.expectMessage("'mailet' is mandatory");
-        MessageAlteringUtils.from(null).build();
+    void buildShouldThrowWhenMailetIsNull() {
+        assertThatThrownBy(() -> MessageAlteringUtils.from(null).build())
+            .isInstanceOf(NullPointerException.class)
+            .hasMessage("'mailet' is mandatory");
     }
 
     @Test
-    public void buildShouldThrowWhenOriginalMailIsNull() {
-        expectedException.expect(NullPointerException.class);
-        expectedException.expectMessage("'originalMail' is mandatory");
-        MessageAlteringUtils.from(mock(RedirectNotify.class))
-            .build();
+    void buildShouldThrowWhenOriginalMailIsNull() {
+        assertThatThrownBy(() -> MessageAlteringUtils.from(mock(RedirectNotify.class))
+                .build())
+            .isInstanceOf(NullPointerException.class)
+            .hasMessage("'originalMail' is mandatory");
     }
 
     @Test
-    public void buildShouldWorkWhenEverythingProvided() {
+    void buildShouldWorkWhenEverythingProvided() {
         MessageAlteringUtils.from(mock(RedirectNotify.class))
             .originalMail(mock(Mail.class))
             .build();
     }
 
     @Test
-    public void getFileNameShouldReturnNoSubjectWhenSubjectIsNull() {
+    void getFileNameShouldReturnNoSubjectWhenSubjectIsNull() {
         MessageAlteringUtils alteredMailUtils = MessageAlteringUtils.from(mock(RedirectNotify.class))
                 .originalMail(mock(Mail.class))
                 .build();
@@ -65,7 +61,7 @@ public class MessageAlteringUtilsTest {
     }
 
     @Test
-    public void getFileNameShouldReturnNoSubjectWhenSubjectContainsOnlySpaces() {
+    void getFileNameShouldReturnNoSubjectWhenSubjectContainsOnlySpaces() {
         MessageAlteringUtils alteredMailUtils = MessageAlteringUtils.from(mock(RedirectNotify.class))
                 .originalMail(mock(Mail.class))
                 .build();
@@ -76,7 +72,7 @@ public class MessageAlteringUtilsTest {
     }
 
     @Test
-    public void getFileNameShouldReturnSubjectWhenSubjectIsGiven() {
+    void getFileNameShouldReturnSubjectWhenSubjectIsGiven() {
         MessageAlteringUtils alteredMailUtils = MessageAlteringUtils.from(mock(RedirectNotify.class))
                 .originalMail(mock(Mail.class))
                 .build();
@@ -87,7 +83,7 @@ public class MessageAlteringUtilsTest {
     }
 
     @Test
-    public void getFileNameShouldReturnTrimmedSubjectWhenSubjectStartsWithSpaces() {
+    void getFileNameShouldReturnTrimmedSubjectWhenSubjectStartsWithSpaces() {
         MessageAlteringUtils alteredMailUtils = MessageAlteringUtils.from(mock(RedirectNotify.class))
                 .originalMail(mock(Mail.class))
                 .build();
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DelayTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DelayTest.java
index dafaf83..4ae48a0 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DelayTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DelayTest.java
@@ -26,102 +26,91 @@ import java.time.Duration;
 
 import javax.mail.MessagingException;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 public class DelayTest {
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     @Test
-    public void defaultConstructorShouldConstructDefaultDelay() {
+    void defaultConstructorShouldConstructDefaultDelay() {
         assertThat(new Delay())
             .isEqualTo(new Delay(Delay.DEFAULT_ATTEMPTS, Delay.DEFAULT_DELAY_TIME));
     }
 
     @Test
-    public void stringConstructorShouldWorkForNumbers() throws Exception {
+    void stringConstructorShouldWorkForNumbers() throws Exception {
         assertThat(Delay.from("36")).isEqualTo(new Delay(Delay.DEFAULT_ATTEMPTS, Duration.ofMillis(36)));
     }
 
     @Test
-    public void stringConstructorShouldWorkForZero() throws Exception {
+    void stringConstructorShouldWorkForZero() throws Exception {
         assertThat(Delay.from("0")).isEqualTo(new Delay(Delay.DEFAULT_ATTEMPTS, Duration.ofMillis(0)));
     }
 
     @Test
-    public void stringConstructorShouldThrowOnNegativeNumbers() {
+    void stringConstructorShouldThrowOnNegativeNumbers() {
         assertThatThrownBy(() -> Delay.from("-1s"))
             .isInstanceOf(IllegalArgumentException.class)
             .hasMessage("Duration amount should be positive");
     }
 
     @Test
-    public void stringConstructorShouldWorkForNumberAndSecond() throws Exception {
+    void stringConstructorShouldWorkForNumberAndSecond() throws Exception {
         assertThat(Delay.from("1s")).isEqualTo(new Delay(Delay.DEFAULT_ATTEMPTS, Duration.ofSeconds(1)));
     }
 
     @Test
-    public void stringConstructorShouldWorkForNumberAndAttempts() throws Exception {
+    void stringConstructorShouldWorkForNumberAndAttempts() throws Exception {
         assertThat(Delay.from("2*36")).isEqualTo(new Delay(2, Duration.ofMillis(36)));
     }
 
     @Test
-    public void stringConstructorShouldWorkForNumberAndZeroAttempts() throws Exception {
+    void stringConstructorShouldWorkForNumberAndZeroAttempts() throws Exception {
         assertThat(Delay.from("0*36")).isEqualTo(new Delay(0, Duration.ofMillis(36)));
     }
 
     @Test
-    public void stringConstructorShouldThrowOnNegativeAttempts() throws Exception {
-        expectedException.expect(MessagingException.class);
-
-        Delay.from("-1*36");
+    void stringConstructorShouldThrowOnNegativeAttempts() {
+        assertThatThrownBy(() -> Delay.from("-1*36"))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void stringConstructorShouldThrowWhenAttemptsOmitted() throws Exception {
-        expectedException.expect(NumberFormatException.class);
-
-        Delay.from("*36");
+    void stringConstructorShouldThrowWhenAttemptsOmitted() {
+        assertThatThrownBy(() -> Delay.from("36*"))
+            .isInstanceOf(NumberFormatException.class);
     }
 
     @Test
-    public void stringConstructorShouldThrowWhenDelayOmitted() throws Exception {
-        expectedException.expect(NumberFormatException.class);
-
-        Delay.from("2*");
+    void stringConstructorShouldThrowWhenDelayOmitted() {
+        assertThatThrownBy(() -> Delay.from("2*"))
+            .isInstanceOf(NumberFormatException.class);
     }
 
     @Test
-    public void stringConstructorShouldWorkForNumberAttemptsAndUnit() throws Exception {
+    void stringConstructorShouldWorkForNumberAttemptsAndUnit() throws Exception {
         assertThat(Delay.from("2*36s")).isEqualTo(new Delay(2, Duration.ofSeconds(36)));
     }
     
     @Test
-    public void stringConstructorShouldWorkForNumberAttemptsAndUnitWithSpaces() throws Exception {
+    void stringConstructorShouldWorkForNumberAttemptsAndUnitWithSpaces() throws Exception {
         assertThat(Delay.from("2 * 36 s")).isEqualTo(new Delay(2, Duration.ofSeconds(36)));
     }
 
     @Test
-    public void stringConstructorShouldThrowOnInvalidInput() throws Exception {
-        expectedException.expect(NumberFormatException.class);
-
-        Delay.from("invalid");
+    void stringConstructorShouldThrowOnInvalidInput() {
+        assertThatThrownBy(() -> Delay.from("invalid"))
+            .isInstanceOf(NumberFormatException.class);
     }
 
     @Test
-    public void stringConstructorShouldThrowOnInvalidUnit() throws Exception {
-        expectedException.expect(NumberFormatException.class);
-
-        Delay.from("36invalid");
+    void stringConstructorShouldThrowOnInvalidUnit() {
+        assertThatThrownBy(() -> Delay.from("36invalid"))
+            .isInstanceOf(NumberFormatException.class);
     }
 
     @Test
-    public void stringConstructorShouldThrowOnEmptyString() throws Exception {
-        expectedException.expect(NumberFormatException.class);
-
-        Delay.from("");
+    void stringConstructorShouldThrowOnEmptyString() {
+        assertThatThrownBy(() -> Delay.from(""))
+            .isInstanceOf(NumberFormatException.class);
     }
 }
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DelaysAndMaxRetryTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DelaysAndMaxRetryTest.java
index d72ecfc..49d09a8 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DelaysAndMaxRetryTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DelaysAndMaxRetryTest.java
@@ -20,24 +20,20 @@
 package org.apache.james.transport.mailets.remote.delivery;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.time.Duration;
 
 import javax.mail.MessagingException;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
 public class DelaysAndMaxRetryTest {
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     @Test
-    public void fromShouldParseSingleDelay() throws Exception {
+    void fromShouldParseSingleDelay() throws Exception {
         DelaysAndMaxRetry actual = DelaysAndMaxRetry.from(1, "1s");
 
         DelaysAndMaxRetry expected = new DelaysAndMaxRetry(1, ImmutableList.of(new Delay(1, Duration.ofSeconds(1))));
@@ -46,7 +42,7 @@ public class DelaysAndMaxRetryTest {
     }
 
     @Test
-    public void fromShouldParseTwoDelays() throws Exception {
+    void fromShouldParseTwoDelays() throws Exception {
         DelaysAndMaxRetry actual = DelaysAndMaxRetry.from(2, "1s,2s");
 
         DelaysAndMaxRetry expected = new DelaysAndMaxRetry(2, ImmutableList.of(new Delay(1, Duration.ofSeconds(1)), new Delay(1, Duration.ofSeconds(2))));
@@ -55,7 +51,7 @@ public class DelaysAndMaxRetryTest {
     }
 
     @Test
-    public void fromShouldAdaptMaxRetriesWhenUnderAttempts() throws Exception {
+    void fromShouldAdaptMaxRetriesWhenUnderAttempts() throws Exception {
         DelaysAndMaxRetry actual = DelaysAndMaxRetry.from(1, "1s,2*2s");
 
         DelaysAndMaxRetry expected = new DelaysAndMaxRetry(3, ImmutableList.of(new Delay(1, Duration.ofSeconds(1)), new Delay(2, Duration.ofSeconds(2))));
@@ -64,7 +60,7 @@ public class DelaysAndMaxRetryTest {
     }
 
     @Test
-    public void fromShouldAdaptDelaysWhenUnderMaxRetries() throws Exception {
+    void fromShouldAdaptDelaysWhenUnderMaxRetries() throws Exception {
         DelaysAndMaxRetry actual = DelaysAndMaxRetry.from(4, "1s,2*2s");
 
         DelaysAndMaxRetry expected = new DelaysAndMaxRetry(4, ImmutableList.of(new Delay(1, Duration.ofSeconds(1)), new Delay(3, Duration.ofSeconds(2))));
@@ -73,7 +69,7 @@ public class DelaysAndMaxRetryTest {
     }
 
     @Test
-    public void fromShouldHandleNullValuesForDelayAsString() throws Exception {
+    void fromShouldHandleNullValuesForDelayAsString() throws Exception {
         DelaysAndMaxRetry actual = DelaysAndMaxRetry.from(1, null);
 
         DelaysAndMaxRetry expected = new DelaysAndMaxRetry(1, ImmutableList.of(new Delay(Delay.DEFAULT_ATTEMPTS, Delay.DEFAULT_DELAY_TIME)));
@@ -82,7 +78,7 @@ public class DelaysAndMaxRetryTest {
     }
 
     @Test
-    public void fromShouldIgnoreEmptyDelay() throws Exception {
+    void fromShouldIgnoreEmptyDelay() throws Exception {
         DelaysAndMaxRetry actual = DelaysAndMaxRetry.from(1, "1s,,2s");
 
         DelaysAndMaxRetry expected = new DelaysAndMaxRetry(2, ImmutableList.of(new Delay(1, Duration.ofSeconds(1)), new Delay(1, Duration.ofSeconds(2))));
@@ -91,7 +87,7 @@ public class DelaysAndMaxRetryTest {
     }
 
     @Test
-    public void fromShouldHandleParsingFailures() throws Exception {
+    void fromShouldHandleParsingFailures() throws Exception {
         DelaysAndMaxRetry actual = DelaysAndMaxRetry.from(3, "1s,invalid,2s");
 
         DelaysAndMaxRetry expected = new DelaysAndMaxRetry(3, ImmutableList.of(new Delay(3, Duration.ofSeconds(1))));
@@ -100,7 +96,7 @@ public class DelaysAndMaxRetryTest {
     }
 
     @Test
-    public void fromShouldHandleEmptyStringWithZeroMaxRetries() throws Exception {
+    void fromShouldHandleEmptyStringWithZeroMaxRetries() throws Exception {
         DelaysAndMaxRetry actual = DelaysAndMaxRetry.from(0, "");
 
         DelaysAndMaxRetry expected = new DelaysAndMaxRetry(0, ImmutableList.<Delay>of());
@@ -109,36 +105,35 @@ public class DelaysAndMaxRetryTest {
     }
 
     @Test
-    public void fromShouldThrowOnEmptyStringWithNonZeroMaxRetry() throws Exception {
-        expectedException.expect(MessagingException.class);
-
-        DelaysAndMaxRetry.from(2, "");
+    void fromShouldThrowOnEmptyStringWithNonZeroMaxRetry() {
+        assertThatThrownBy(() -> DelaysAndMaxRetry.from(2, ""))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void getExpandedDelaysShouldReturnEmptyWhenNoDelay() throws Exception {
+    void getExpandedDelaysShouldReturnEmptyWhenNoDelay() throws Exception {
         DelaysAndMaxRetry testee = DelaysAndMaxRetry.from(0, "");
 
         assertThat(testee.getExpandedDelays()).isEmpty();
     }
 
     @Test
-    public void getExpandedDelaysShouldExpandSingleDelays() throws Exception {
+    void getExpandedDelaysShouldExpandSingleDelays() throws Exception {
         DelaysAndMaxRetry testee = DelaysAndMaxRetry.from(3, "1*1S,1*2S,1*5S");
 
         assertThat(testee.getExpandedDelays()).containsExactly(Duration.ofSeconds(1), Duration.ofSeconds(2), Duration.ofSeconds(5));
     }
 
     @Test
-    public void getExpandedDelaysShouldExpandMultipleDelays() throws Exception {
+    void getExpandedDelaysShouldExpandMultipleDelays() throws Exception {
         DelaysAndMaxRetry testee = DelaysAndMaxRetry.from(3, "1*1S,2*2S,2*5S");
 
         assertThat(testee.getExpandedDelays())
             .containsExactly(Duration.ofSeconds(1), Duration.ofSeconds(2), Duration.ofSeconds(2), Duration.ofSeconds(5), Duration.ofSeconds(5));
     }
-    
+
     @Test
-    public void getExpandedDelaysShouldExpandMultipleDelaysWithSpaces() throws Exception {
+    void getExpandedDelaysShouldExpandMultipleDelaysWithSpaces() throws Exception {
         DelaysAndMaxRetry testee = DelaysAndMaxRetry.from(3, "1 * 1 S, 2 * 2 S , 2 * 5 S");
 
         assertThat(testee.getExpandedDelays())
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnableTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnableTest.java
index 671ce3a..0990cd0 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnableTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRunnableTest.java
@@ -22,6 +22,7 @@ package org.apache.james.transport.mailets.remote.delivery;
 import static org.apache.james.transport.mailets.remote.delivery.Bouncer.IS_DELIVERY_PERMANENT_ERROR;
 import static org.apache.james.transport.mailets.remote.delivery.DeliveryRunnable.OUTGOING_MAILS;
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.mock;
@@ -41,27 +42,22 @@ import org.apache.mailet.AttributeValue;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class DeliveryRunnableTest {
 
     public static final Date FIXED_DATE = new Date(1159599194961L);
     public static final Supplier<Date> FIXED_DATE_SUPPLIER = () -> FIXED_DATE;
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private DeliveryRunnable testee;
     private RecordingMetricFactory metricFactory;
     private Bouncer bouncer;
     private MailDelivrer mailDelivrer;
     private MailQueue mailQueue;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.DEBUG, "true")
             .setProperty(RemoteDeliveryConfiguration.DELAY_TIME, "1000,2000,3000,4000,5000")
@@ -76,7 +72,7 @@ public class DeliveryRunnableTest {
     }
 
     @Test
-    public void deliverySuccessShouldIncrementMetric() throws Exception {
+    void deliverySuccessShouldIncrementMetric() throws Exception {
         FakeMail fakeMail = FakeMail.defaultFakeMail();
         when(mailDelivrer.deliver(fakeMail)).thenReturn(ExecutionResult.success());
 
@@ -87,7 +83,7 @@ public class DeliveryRunnableTest {
     }
 
     @Test
-    public void deliveryPermanentFailureShouldBounceTheMail() throws Exception {
+    void deliveryPermanentFailureShouldBounceTheMail() throws Exception {
         FakeMail fakeMail = FakeMail.defaultFakeMail();
         Exception exception = new Exception();
         when(mailDelivrer.deliver(fakeMail)).thenReturn(ExecutionResult.permanentFailure(exception));
@@ -99,7 +95,7 @@ public class DeliveryRunnableTest {
     }
 
     @Test
-    public void deliveryPermanentFailureShouldNotIncrementDeliveryMetric() throws Exception {
+    void deliveryPermanentFailureShouldNotIncrementDeliveryMetric() throws Exception {
         FakeMail fakeMail = FakeMail.defaultFakeMail();
         Exception exception = new Exception();
         when(mailDelivrer.deliver(fakeMail)).thenReturn(ExecutionResult.permanentFailure(exception));
@@ -111,7 +107,7 @@ public class DeliveryRunnableTest {
     }
 
     @Test
-    public void deliveryTemporaryFailureShouldNotIncrementDeliveryMetric() throws Exception {
+    void deliveryTemporaryFailureShouldNotIncrementDeliveryMetric() throws Exception {
         FakeMail fakeMail = FakeMail.builder().name("name").state(Mail.DEFAULT).build();
         Exception exception = new Exception();
         when(mailDelivrer.deliver(fakeMail)).thenReturn(ExecutionResult.temporaryFailure(exception));
@@ -123,18 +119,17 @@ public class DeliveryRunnableTest {
     }
 
     @Test
-    public void deliveryTemporaryFailureShouldFailOnMailsWithoutState() throws Exception {
+    void deliveryTemporaryFailureShouldFailOnMailsWithoutState() throws Exception {
         FakeMail fakeMail = FakeMail.defaultFakeMail();
         Exception exception = new Exception();
         when(mailDelivrer.deliver(fakeMail)).thenReturn(ExecutionResult.temporaryFailure(exception));
 
-        expectedException.expect(NullPointerException.class);
-
-        testee.attemptDelivery(fakeMail);
+        assertThatThrownBy(() -> testee.attemptDelivery(fakeMail))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void deliveryTemporaryFailureShouldRetryDelivery() throws Exception {
+    void deliveryTemporaryFailureShouldRetryDelivery() throws Exception {
         FakeMail fakeMail = FakeMail.builder().name("name").state(Mail.DEFAULT).build();
         Exception exception = new Exception();
         when(mailDelivrer.deliver(fakeMail)).thenReturn(ExecutionResult.temporaryFailure(exception));
@@ -153,7 +148,7 @@ public class DeliveryRunnableTest {
     }
 
     @Test
-    public void deliveryTemporaryFailureShouldRetryDeliveryWithRightDelay() throws Exception {
+    void deliveryTemporaryFailureShouldRetryDeliveryWithRightDelay() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
             .name("name")
             .state(Mail.ERROR)
@@ -176,7 +171,7 @@ public class DeliveryRunnableTest {
     }
 
     @Test
-    public void deliveryTemporaryFailureShouldRetryDeliveryOnMaximumRetryNumber() throws Exception {
+    void deliveryTemporaryFailureShouldRetryDeliveryOnMaximumRetryNumber() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
             .name("name")
             .state(Mail.ERROR)
@@ -199,7 +194,7 @@ public class DeliveryRunnableTest {
     }
 
     @Test
-    public void deliveryTemporaryFailureShouldNotRetryDeliveryOverMaximumRetryNumber() throws Exception {
+    void deliveryTemporaryFailureShouldNotRetryDeliveryOverMaximumRetryNumber() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
             .name("name")
             .state(Mail.ERROR)
@@ -214,7 +209,7 @@ public class DeliveryRunnableTest {
     }
 
     @Test
-    public void deliveryTemporaryFailureShouldBounceWhenRetryExceeded() throws Exception {
+    void deliveryTemporaryFailureShouldBounceWhenRetryExceeded() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
             .name("name")
             .state(Mail.ERROR)
@@ -230,7 +225,7 @@ public class DeliveryRunnableTest {
     }
 
     @Test
-    public void deliveryTemporaryFailureShouldResetDeliveryCountOnNonErrorState() throws Exception {
+    void deliveryTemporaryFailureShouldResetDeliveryCountOnNonErrorState() throws Exception {
         FakeMail fakeMail = FakeMail.builder()
             .name("name")
             .state(Mail.DEFAULT)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/HeloNameProviderTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/HeloNameProviderTest.java
index e2c38c5..02be85f 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/HeloNameProviderTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/HeloNameProviderTest.java
@@ -20,41 +20,36 @@
 package org.apache.james.transport.mailets.remote.delivery;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import org.apache.james.core.Domain;
 import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.domainlist.api.DomainListException;
-import org.apache.james.transport.mailets.remote.delivery.HeloNameProvider;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class HeloNameProviderTest {
 
     public static final String DOMAIN = "domain";
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private DomainList domainList;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         domainList = mock(DomainList.class);
     }
 
     @Test
-    public void getHeloNameShouldReturnNonNullProvidedHeloName() {
+    void getHeloNameShouldReturnNonNullProvidedHeloName() {
         HeloNameProvider heloNameProvider = new HeloNameProvider(DOMAIN, domainList);
 
         assertThat(heloNameProvider.getHeloName()).isEqualTo(DOMAIN);
     }
 
     @Test
-    public void getHeloNameShouldReturnDomainListDefaultDomainOnNullHeloName() throws DomainListException {
+    void getHeloNameShouldReturnDomainListDefaultDomainOnNullHeloName() throws DomainListException {
         when(domainList.getDefaultDomain()).thenReturn(Domain.of(DOMAIN));
         HeloNameProvider heloNameProvider = new HeloNameProvider(null, domainList);
 
@@ -62,7 +57,7 @@ public class HeloNameProviderTest {
     }
 
     @Test
-    public void getHeloNameShouldReturnLocalhostOnDomainListException() throws DomainListException {
+    void getHeloNameShouldReturnLocalhostOnDomainListException() throws DomainListException {
         when(domainList.getDefaultDomain()).thenThrow(new DomainListException("any message"));
         HeloNameProvider heloNameProvider = new HeloNameProvider(null, domainList);
 
@@ -70,12 +65,12 @@ public class HeloNameProviderTest {
     }
 
     @Test
-    public void getHeloNameShouldPropagateRuntimeExceptions() throws DomainListException {
+    void getHeloNameShouldPropagateRuntimeExceptions() throws DomainListException {
         when(domainList.getDefaultDomain()).thenThrow(new RuntimeException());
         HeloNameProvider heloNameProvider = new HeloNameProvider(null, domainList);
 
-        expectedException.expect(RuntimeException.class);
-        heloNameProvider.getHeloName();
+        assertThatThrownBy(heloNameProvider::getHeloName)
+            .isInstanceOf(RuntimeException.class);
     }
 
 }
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/InternetAddressConverterTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/InternetAddressConverterTest.java
index d4283b3..c49acda 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/InternetAddressConverterTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/InternetAddressConverterTest.java
@@ -20,41 +20,36 @@
 package org.apache.james.transport.mailets.remote.delivery;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import javax.mail.internet.InternetAddress;
 
 import org.apache.mailet.base.MailAddressFixture;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
 public class InternetAddressConverterTest {
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     @Test
-    public void convertShouldWorkWithEmptyAddressList() {
+    void convertShouldWorkWithEmptyAddressList() {
         assertThat(InternetAddressConverter.convert(ImmutableList.of())).isEmpty();
     }
 
     @Test
-    public void convertShouldThrowOnNullAddress() {
-        expectedException.expect(NullPointerException.class);
-
-        InternetAddressConverter.convert(null);
+    void convertShouldThrowOnNullAddress() {
+        assertThatThrownBy(() -> InternetAddressConverter.convert(null))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void convertShouldWorkWithOneAddress() throws Exception {
+    void convertShouldWorkWithOneAddress() throws Exception {
         assertThat(InternetAddressConverter.convert(ImmutableList.of(MailAddressFixture.ANY_AT_JAMES)))
             .containsOnly(new InternetAddress(MailAddressFixture.ANY_AT_JAMES.asString()));
     }
 
     @Test
-    public void convertShouldWorkWithTwoAddress() throws Exception {
+    void convertShouldWorkWithTwoAddress() throws Exception {
         assertThat(InternetAddressConverter.convert(ImmutableList.of(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES)))
             .containsOnly(new InternetAddress(MailAddressFixture.ANY_AT_JAMES.asString()), new InternetAddress(MailAddressFixture.OTHER_AT_JAMES.asString()));
     }
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryConfigurationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryConfigurationTest.java
index 64e38e9..1fbbba2 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryConfigurationTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryConfigurationTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets.remote.delivery;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -30,17 +31,12 @@ import org.apache.james.core.Domain;
 import org.apache.james.domainlist.api.DomainList;
 import org.apache.mailet.base.test.FakeMailetConfig;
 import org.assertj.core.data.MapEntry;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 public class RemoteDeliveryConfigurationTest {
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     @Test
-    public void isDebugShouldBeFalseByDefault() {
+    void isDebugShouldBeFalseByDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -48,7 +44,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isDebugShouldBeTrueIfSpecified() {
+    void isDebugShouldBeTrueIfSpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.DEBUG, "true")
             .build();
@@ -57,7 +53,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isDebugShouldBeFalseIfSpecified() {
+    void isDebugShouldBeFalseIfSpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.DEBUG, "false")
             .build();
@@ -66,7 +62,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isDebugShouldBeFalseIfParsingException() {
+    void isDebugShouldBeFalseIfParsingException() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.DEBUG, "invalid")
             .build();
@@ -75,7 +71,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getSmtpTimeoutShouldReturnDefault() {
+    void getSmtpTimeoutShouldReturnDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -84,7 +80,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getSmtpTimeoutShouldReturnProvidedValue() {
+    void getSmtpTimeoutShouldReturnProvidedValue() {
         int value = 150000;
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.TIMEOUT, String.valueOf(value))
@@ -95,7 +91,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getSmtpTimeoutShouldReturnDefaultIfParsingException() {
+    void getSmtpTimeoutShouldReturnDefaultIfParsingException() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.TIMEOUT, "invalid")
             .build();
@@ -105,7 +101,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getSmtpTimeoutShouldReturnProvidedValueWhenZero() {
+    void getSmtpTimeoutShouldReturnProvidedValueWhenZero() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.TIMEOUT, "0")
             .build();
@@ -115,7 +111,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getSmtpTimeoutShouldReturnProvidedValueWhenNegativeNumber() {
+    void getSmtpTimeoutShouldReturnProvidedValueWhenNegativeNumber() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.TIMEOUT, "-1")
             .build();
@@ -125,7 +121,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getOutGoingQueueNameShouldReturnDefault() {
+    void getOutGoingQueueNameShouldReturnDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -134,7 +130,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getOutGoingQueueNameShouldReturnProvidedValue() {
+    void getOutGoingQueueNameShouldReturnProvidedValue() {
         String value = "value";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.OUTGOING, value)
@@ -145,7 +141,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getConnectionTimeoutShouldReturnDefault() {
+    void getConnectionTimeoutShouldReturnDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -154,7 +150,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getConnectionTimeoutShouldReturnProvidedValue() {
+    void getConnectionTimeoutShouldReturnProvidedValue() {
         int value = 150000;
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.CONNECTIONTIMEOUT, String.valueOf(value))
@@ -165,7 +161,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getConnectionTimeoutShouldReturnDefaultIfParsingException() {
+    void getConnectionTimeoutShouldReturnDefaultIfParsingException() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.CONNECTIONTIMEOUT, "invalid")
             .build();
@@ -175,7 +171,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getConnectionTimeoutShouldReturnProvidedValueWhenZero() {
+    void getConnectionTimeoutShouldReturnProvidedValueWhenZero() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.CONNECTIONTIMEOUT, "0")
             .build();
@@ -185,7 +181,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getConnectionTimeoutShouldReturnProvidedValueWhenNegativeNumber() {
+    void getConnectionTimeoutShouldReturnProvidedValueWhenNegativeNumber() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.CONNECTIONTIMEOUT, "-1")
             .build();
@@ -195,7 +191,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isSendPartialShouldBeFalseByDefault() {
+    void isSendPartialShouldBeFalseByDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -203,7 +199,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isSendPartialShouldBeTrueIfSpecified() {
+    void isSendPartialShouldBeTrueIfSpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.SENDPARTIAL, "true")
             .build();
@@ -212,7 +208,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isSendPartialShouldBeFalseIfSpecified() {
+    void isSendPartialShouldBeFalseIfSpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.SENDPARTIAL, "false")
             .build();
@@ -221,7 +217,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isSendPartialShouldBeFalseIfParsingException() {
+    void isSendPartialShouldBeFalseIfParsingException() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.SENDPARTIAL, "invalid")
             .build();
@@ -230,7 +226,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getBounceProcessorShouldReturnNullByDefault() {
+    void getBounceProcessorShouldReturnNullByDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -239,7 +235,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getBounceProcessorShouldReturnProvidedValue() {
+    void getBounceProcessorShouldReturnProvidedValue() {
         String value = "value";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.BOUNCE_PROCESSOR, value)
@@ -250,7 +246,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isStartTLSShouldBeFalseByDefault() {
+    void isStartTLSShouldBeFalseByDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -258,7 +254,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isStartTLSShouldBeTrueIfSpecified() {
+    void isStartTLSShouldBeTrueIfSpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.START_TLS, "true")
             .build();
@@ -267,7 +263,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isStartTLSShouldBeFalseIfSpecified() {
+    void isStartTLSShouldBeFalseIfSpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.START_TLS, "false")
             .build();
@@ -276,7 +272,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isStartTLSShouldBeFalseIfParsingException() {
+    void isStartTLSShouldBeFalseIfParsingException() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.START_TLS, "invalid")
             .build();
@@ -285,7 +281,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isSSLEnableShouldBeFalseByDefault() {
+    void isSSLEnableShouldBeFalseByDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -293,7 +289,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isSSLEnableShouldBeTrueIfSpecified() {
+    void isSSLEnableShouldBeTrueIfSpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.SSL_ENABLE, "true")
             .build();
@@ -302,7 +298,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isSSLEnableShouldBeFalseIfSpecified() {
+    void isSSLEnableShouldBeFalseIfSpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.SSL_ENABLE, "false")
             .build();
@@ -311,7 +307,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isSSLEnableShouldBeFalseIfParsingException() {
+    void isSSLEnableShouldBeFalseIfParsingException() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.SSL_ENABLE, "invalid")
             .build();
@@ -320,7 +316,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isBindUsedShouldBeFalseByDefault() {
+    void isBindUsedShouldBeFalseByDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.BIND, "127.0.0.1:25")
             .build();
@@ -329,7 +325,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getBindAddressShouldBeNullByDefault() {
+    void getBindAddressShouldBeNullByDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -337,7 +333,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getBindAddressShouldReturnProvidedValue() {
+    void getBindAddressShouldReturnProvidedValue() {
         String value = "127.0.0.1:25";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.BIND, value)
@@ -347,7 +343,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getDnsProblemRetryShouldReturnDefault() {
+    void getDnsProblemRetryShouldReturnDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -356,7 +352,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getDnsProblemRetryShouldReturnProvidedValue() {
+    void getDnsProblemRetryShouldReturnProvidedValue() {
         int value = 4;
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.MAX_DNS_PROBLEM_RETRIES, String.valueOf(value))
@@ -367,18 +363,17 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void constructorShouldThrowOnInvalidDnsRetries() {
+    void constructorShouldThrowOnInvalidDnsRetries() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.MAX_DNS_PROBLEM_RETRIES, "invalid")
             .build();
 
-        expectedException.expect(NumberFormatException.class);
-
-        new RemoteDeliveryConfiguration(mailetConfig, mock(DomainList.class));
+        assertThatThrownBy(() -> new RemoteDeliveryConfiguration(mailetConfig, mock(DomainList.class)))
+            .isInstanceOf(NumberFormatException.class);
     }
 
     @Test
-    public void getDnsProblemRetryShouldReturnProvidedValueWhenZero() {
+    void getDnsProblemRetryShouldReturnProvidedValueWhenZero() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.MAX_DNS_PROBLEM_RETRIES, "0")
             .build();
@@ -388,7 +383,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getDnsProblemRetryShouldReturnProvidedValueWhenEmpty() {
+    void getDnsProblemRetryShouldReturnProvidedValueWhenEmpty() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.MAX_DNS_PROBLEM_RETRIES, "")
             .build();
@@ -398,7 +393,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getDnsProblemRetryShouldReturnProvidedValueWhenNegativeNumber() {
+    void getDnsProblemRetryShouldReturnProvidedValueWhenNegativeNumber() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.MAX_DNS_PROBLEM_RETRIES, "-1")
             .build();
@@ -408,7 +403,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isUsePriorityShouldBeFalseByDefault() {
+    void isUsePriorityShouldBeFalseByDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -416,7 +411,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isUsePriorityShouldBeTrueIfSpecified() {
+    void isUsePriorityShouldBeTrueIfSpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.USE_PRIORITY, "true")
             .build();
@@ -425,7 +420,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isUsePriorityShouldBeFalseIfSpecified() {
+    void isUsePriorityShouldBeFalseIfSpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.USE_PRIORITY, "false")
             .build();
@@ -434,7 +429,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void isUsePriorityShouldBeFalseIfParsingException() {
+    void isUsePriorityShouldBeFalseIfParsingException() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.USE_PRIORITY, "invalid")
             .build();
@@ -443,7 +438,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getHeloNameProviderShouldCallDomainListByDefault() throws Exception {
+    void getHeloNameProviderShouldCallDomainListByDefault() throws Exception {
         DomainList domainList = mock(DomainList.class);
         String value = "value";
         when(domainList.getDefaultDomain()).thenReturn(Domain.of(value));
@@ -455,7 +450,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getHeloNameProviderShouldTakeCareOfProvidedValue() {
+    void getHeloNameProviderShouldTakeCareOfProvidedValue() {
         String value = "value";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.HELO_NAME, value)
@@ -466,7 +461,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getJavaxAdditionalPropertiesShouldBeEmptyByDefault() {
+    void getJavaxAdditionalPropertiesShouldBeEmptyByDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -475,7 +470,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getJavaxAdditionalPropertiesShouldTakeOneEntryIntoAccount() {
+    void getJavaxAdditionalPropertiesShouldTakeOneEntryIntoAccount() {
         String key1 = RemoteDeliveryConfiguration.JAVAX_PREFIX + "property1";
         String value1 = "value1";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
@@ -487,7 +482,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getJavaxAdditionalPropertiesShouldTakeTwoEntriesIntoAccount() {
+    void getJavaxAdditionalPropertiesShouldTakeTwoEntriesIntoAccount() {
         String key1 = RemoteDeliveryConfiguration.JAVAX_PREFIX + "property1";
         String value1 = "value1";
         String key2 = RemoteDeliveryConfiguration.JAVAX_PREFIX + "property2";
@@ -502,19 +497,17 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void constructorShouldThrowOnNullValueJavaxProperty() {
-        expectedException.expect(NullPointerException.class);
-
+    void constructorShouldThrowOnNullValueJavaxProperty() {
         String key1 = RemoteDeliveryConfiguration.JAVAX_PREFIX + "property1";
-        FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
-            .setProperty(key1, null)
-            .build();
 
-        new RemoteDeliveryConfiguration(mailetConfig, mock(DomainList.class));
+        assertThatThrownBy(() -> FakeMailetConfig.builder()
+                .setProperty(key1, null)
+                .build())
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void getJavaxAdditionalPropertiesShouldTakeOneEmptyEntryIntoAccount() {
+    void getJavaxAdditionalPropertiesShouldTakeOneEmptyEntryIntoAccount() {
         String key1 = RemoteDeliveryConfiguration.JAVAX_PREFIX + "property1";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(key1, "")
@@ -525,7 +518,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getGatewayServerShouldBeNullByDefault() {
+    void getGatewayServerShouldBeNullByDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -533,7 +526,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getGatewayServerShouldReturnProvidedValue() {
+    void getGatewayServerShouldReturnProvidedValue() {
         String value = "127.0.0.1";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.GATEWAY, value)
@@ -544,7 +537,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getGatewayServerShouldReturnProvidedValues() {
+    void getGatewayServerShouldReturnProvidedValues() {
         String value1 = "127.0.0.1";
         String value2 = "domain";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
@@ -556,7 +549,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getGatewayServerShouldReturnGatewayWithGatewayPort() {
+    void getGatewayServerShouldReturnGatewayWithGatewayPort() {
         String server = "127.0.0.1";
         String port = "2525";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
@@ -569,7 +562,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getGatewayServerShouldOnlyOverridePortsNotInitiallySet() {
+    void getGatewayServerShouldOnlyOverridePortsNotInitiallySet() {
         String server1 = "127.0.0.1:23432";
         String server2 = "domain";
         String port = "2525";
@@ -583,7 +576,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getAuthUserShouldBeNullByDefault() {
+    void getAuthUserShouldBeNullByDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -591,7 +584,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getAuthUserShouldBeNullWhenGatewayIsNotSpecified() {
+    void getAuthUserShouldBeNullWhenGatewayIsNotSpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.GATEWAY_USERNAME, "name")
             .build();
@@ -600,7 +593,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getAuthUserShouldReturnSpecifiedValueWhenGatewaySpecified() {
+    void getAuthUserShouldReturnSpecifiedValueWhenGatewaySpecified() {
         String value = "name";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.GATEWAY_USERNAME, value)
@@ -611,7 +604,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getAuthUserShouldReturnSpecifiedEmptyValueWhenGatewaySpecified() {
+    void getAuthUserShouldReturnSpecifiedEmptyValueWhenGatewaySpecified() {
         String value = "";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.GATEWAY_USERNAME, value)
@@ -622,7 +615,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getAuthUserShouldReturnSpecifiedCompatibilityValueWhenGatewaySpecified() {
+    void getAuthUserShouldReturnSpecifiedCompatibilityValueWhenGatewaySpecified() {
         String value = "name";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.GATEWAY_USERNAME_COMPATIBILITY, value)
@@ -633,7 +626,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getAuthUserShouldReturnSpecifiedEmptyCompatibilityValueWhenGatewaySpecified() {
+    void getAuthUserShouldReturnSpecifiedEmptyCompatibilityValueWhenGatewaySpecified() {
         String value = "";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.GATEWAY_USERNAME_COMPATIBILITY, value)
@@ -644,7 +637,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getAuthUserShouldReturnSpecifiedValueWhenValueAndCompatibilitySpecified() {
+    void getAuthUserShouldReturnSpecifiedValueWhenValueAndCompatibilitySpecified() {
         String value = "name";
         String compatibilityValue = "compatibilityValue";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
@@ -657,7 +650,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getAuthPassShouldBeNullByDefault() {
+    void getAuthPassShouldBeNullByDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -665,7 +658,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getAuthPassShouldBeNullWhenGatewayIsNotSpecified() {
+    void getAuthPassShouldBeNullWhenGatewayIsNotSpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.GATEWAY_PASSWORD, "name")
             .build();
@@ -674,7 +667,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getAuthPassShouldReturnSpecifiedValueWhenGatewaySpecified() {
+    void getAuthPassShouldReturnSpecifiedValueWhenGatewaySpecified() {
         String value = "name";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.GATEWAY_PASSWORD, value)
@@ -685,7 +678,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getAuthPassShouldReturnSpecifiedEmptyValueWhenGatewaySpecified() {
+    void getAuthPassShouldReturnSpecifiedEmptyValueWhenGatewaySpecified() {
         String value = "";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.GATEWAY_PASSWORD, value)
@@ -696,7 +689,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getMaxRetriesShouldReturnProvidedValue() {
+    void getMaxRetriesShouldReturnProvidedValue() {
         int value = 36;
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.MAX_RETRIES, String.valueOf(value))
@@ -706,7 +699,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getMaxRetriesShouldReturnOneWhenZero() {
+    void getMaxRetriesShouldReturnOneWhenZero() {
         int value = 0;
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.MAX_RETRIES, String.valueOf(value))
@@ -716,7 +709,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getMaxRetriesShouldReturnOneWhenNegativeNumber() {
+    void getMaxRetriesShouldReturnOneWhenNegativeNumber() {
         int value = -1;
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.MAX_RETRIES, String.valueOf(value))
@@ -726,7 +719,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getMaxRetriesShouldReturnDefaultWhenNoySpecified() {
+    void getMaxRetriesShouldReturnDefaultWhenNoySpecified() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -735,7 +728,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getDelayTimesShouldReturnDefault() {
+    void getDelayTimesShouldReturnDefault() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .build();
 
@@ -744,7 +737,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void getDelayTimesShouldWorkWithDefaultConfiguration() {
+    void getDelayTimesShouldWorkWithDefaultConfiguration() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.DELAY_TIME, "5000, 100000, 500000")
             .build();
@@ -754,7 +747,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void createFinalJavaxPropertiesShouldProvidePropertiesWithMinimalConfiguration() {
+    void createFinalJavaxPropertiesShouldProvidePropertiesWithMinimalConfiguration() {
         String helo = "domain.com";
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .setProperty(RemoteDeliveryConfiguration.HELO_NAME, helo)
@@ -775,7 +768,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void createFinalJavaxPropertiesShouldProvidePropertiesWithFullConfigurationWithoutGateway() {
+    void createFinalJavaxPropertiesShouldProvidePropertiesWithFullConfigurationWithoutGateway() {
         String helo = "domain.com";
         int connectionTimeout = 1856;
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
@@ -801,7 +794,7 @@ public class RemoteDeliveryConfigurationTest {
     }
 
     @Test
-    public void createFinalJavaxPropertiesShouldProvidePropertiesWithFullConfigurationWithGateway() {
+    void createFinalJavaxPropertiesShouldProvidePropertiesWithFullConfigurationWithGateway() {
         String helo = "domain.com";
         int connectionTimeout = 1856;
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RepeatTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RepeatTest.java
index a25dd18..2ea3f56 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RepeatTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RepeatTest.java
@@ -20,36 +20,32 @@
 package org.apache.james.transport.mailets.remote.delivery;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 public class RepeatTest {
 
     public static final String ELEMENT = "a";
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
 
     @Test
-    public void repeatShouldThrowOnNegativeTimes() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        Repeat.repeat(new Object(), -1);
+    void repeatShouldThrowOnNegativeTimes() {
+        assertThatThrownBy(() -> Repeat.repeat(new Object(), -1))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void repeatShouldReturnEmptyListOnZeroTimes() {
+    void repeatShouldReturnEmptyListOnZeroTimes() {
         assertThat(Repeat.repeat(new Object(), 0)).isEmpty();
     }
 
     @Test
-    public void repeatShouldWorkWithOneElement() {
+    void repeatShouldWorkWithOneElement() {
         assertThat(Repeat.repeat(ELEMENT, 1)).containsExactly(ELEMENT);
     }
 
     @Test
-    public void repeatShouldWorkWithTwoElements() {
+    void repeatShouldWorkWithTwoElements() {
         assertThat(Repeat.repeat(ELEMENT, 2)).containsExactly(ELEMENT, ELEMENT);
     }
 
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/MailAddressUtilsTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/MailAddressUtilsTest.java
index d64b322..7dab9f3 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/MailAddressUtilsTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/MailAddressUtilsTest.java
@@ -19,6 +19,7 @@
 package org.apache.james.transport.util;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.List;
 
@@ -26,25 +27,20 @@ import javax.mail.internet.InternetAddress;
 
 import org.apache.james.core.MailAddress;
 import org.apache.james.transport.mailets.redirect.SpecialAddress;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
 public class MailAddressUtilsTest {
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     @Test
-    public void fromShouldThrowWhenInternetAddressesIsNull() throws Exception {
-        expectedException.expect(NullPointerException.class);
-        MailAddressUtils.from(null);
+    void fromShouldThrowWhenInternetAddressesIsNull() {
+        assertThatThrownBy(() -> MailAddressUtils.from(null))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void fromShouldReturnOneMailAddressWhenOneInternetAddresse() throws Exception {
+    void fromShouldReturnOneMailAddressWhenOneInternetAddresse() throws Exception {
         List<MailAddress> mailAddresses = MailAddressUtils.from(InternetAddress.parse("user@james.org"));
 
         MailAddress expectedMailAddress = new MailAddress("user", "james.org");
@@ -52,7 +48,7 @@ public class MailAddressUtilsTest {
     }
 
     @Test
-    public void fromShouldReturnMailAddressesWhenInternetAddresses() throws Exception {
+    void fromShouldReturnMailAddressesWhenInternetAddresses() throws Exception {
         List<MailAddress> mailAddresses = MailAddressUtils.from(InternetAddress.parse("user@james.org, user2@apache.org"));
 
         MailAddress expectedMailAddress = new MailAddress("user", "james.org");
@@ -61,110 +57,110 @@ public class MailAddressUtilsTest {
     }
 
     @Test
-    public void toInternetAddressArrayShouldThrowWhenMailAddressesIsNull() {
-        expectedException.expect(NullPointerException.class);
-        MailAddressUtils.toInternetAddressArray(null);
+    void toInternetAddressArrayShouldThrowWhenMailAddressesIsNull() {
+        assertThatThrownBy(() -> MailAddressUtils.toInternetAddressArray(null))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void toInternetAddressArrayShouldReturnOneInternetAddressWhenOneMailAddress() throws Exception {
+    void toInternetAddressArrayShouldReturnOneInternetAddressWhenOneMailAddress() throws Exception {
         InternetAddress[] internetAddresses = MailAddressUtils.toInternetAddressArray(ImmutableList.of(new MailAddress("user", "james.org")));
 
         assertThat(internetAddresses).containsOnly(new InternetAddress("user@james.org"));
     }
 
     @Test
-    public void toInternetAddressArrayShouldReturnInternetAddressesWhenMailAddresses() throws Exception {
+    void toInternetAddressArrayShouldReturnInternetAddressesWhenMailAddresses() throws Exception {
         InternetAddress[] internetAddresses = MailAddressUtils.toInternetAddressArray(ImmutableList.of(new MailAddress("user", "james.org"), new MailAddress("user2", "apache.org")));
 
         assertThat(internetAddresses).containsOnly(new InternetAddress("user@james.org"), new InternetAddress("user2@apache.org"));
     }
 
     @Test
-    public void toInternetAddressesShouldThrowWhenMailAddressesIsNull() {
-        expectedException.expect(NullPointerException.class);
-        MailAddressUtils.toInternetAddresses(null);
+    void toInternetAddressesShouldThrowWhenMailAddressesIsNull() {
+        assertThatThrownBy(() -> MailAddressUtils.toInternetAddresses(null))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void toInternetAddressesShouldReturnOneInternetAddressWhenOneMailAddress() throws Exception {
+    void toInternetAddressesShouldReturnOneInternetAddressWhenOneMailAddress() throws Exception {
         List<InternetAddress> internetAddresses = MailAddressUtils.toInternetAddresses(ImmutableList.of(new MailAddress("user", "james.org")));
 
         assertThat(internetAddresses).containsOnly(new InternetAddress("user@james.org"));
     }
 
     @Test
-    public void toInternetAddressesShouldReturnInternetAddressesWhenMailAddresses() throws Exception {
+    void toInternetAddressesShouldReturnInternetAddressesWhenMailAddresses() throws Exception {
         List<InternetAddress> internetAddresses = MailAddressUtils.toInternetAddresses(ImmutableList.of(new MailAddress("user", "james.org"), new MailAddress("user2", "apache.org")));
 
         assertThat(internetAddresses).containsOnly(new InternetAddress("user@james.org"), new InternetAddress("user2@apache.org"));
     }
 
     @Test
-    public void isUnalteredOrReversePathOrSenderShouldReturnTrueWhenMailAddressIsSpecialUnaltered() {
+    void isUnalteredOrReversePathOrSenderShouldReturnTrueWhenMailAddressIsSpecialUnaltered() {
         boolean unalteredOrReversePathOrSender = MailAddressUtils.isUnalteredOrReversePathOrSender(SpecialAddress.UNALTERED);
 
         assertThat(unalteredOrReversePathOrSender).isTrue();
     }
 
     @Test
-    public void isUnalteredOrReversePathOrSenderShouldReturnTrueWhenMailAddressIsSpecialReversePath() {
+    void isUnalteredOrReversePathOrSenderShouldReturnTrueWhenMailAddressIsSpecialReversePath() {
         boolean unalteredOrReversePathOrSender = MailAddressUtils.isUnalteredOrReversePathOrSender(SpecialAddress.REVERSE_PATH);
 
         assertThat(unalteredOrReversePathOrSender).isTrue();
     }
 
     @Test
-    public void isUnalteredOrReversePathOrSenderShouldReturnTrueWhenMailAddressIsSpecialSender() {
+    void isUnalteredOrReversePathOrSenderShouldReturnTrueWhenMailAddressIsSpecialSender() {
         boolean unalteredOrReversePathOrSender = MailAddressUtils.isUnalteredOrReversePathOrSender(SpecialAddress.SENDER);
 
         assertThat(unalteredOrReversePathOrSender).isTrue();
     }
 
     @Test
-    public void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsSpecialDelete() {
+    void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsSpecialDelete() {
         boolean unalteredOrReversePathOrSender = MailAddressUtils.isUnalteredOrReversePathOrSender(SpecialAddress.DELETE);
 
         assertThat(unalteredOrReversePathOrSender).isFalse();
     }
 
     @Test
-    public void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsSpecialFrom() {
+    void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsSpecialFrom() {
         boolean unalteredOrReversePathOrSender = MailAddressUtils.isUnalteredOrReversePathOrSender(SpecialAddress.FROM);
 
         assertThat(unalteredOrReversePathOrSender).isFalse();
     }
 
     @Test
-    public void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsSpecialNull() {
+    void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsSpecialNull() {
         boolean unalteredOrReversePathOrSender = MailAddressUtils.isUnalteredOrReversePathOrSender(SpecialAddress.NULL);
 
         assertThat(unalteredOrReversePathOrSender).isFalse();
     }
 
     @Test
-    public void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsSpecialRecipients() {
+    void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsSpecialRecipients() {
         boolean unalteredOrReversePathOrSender = MailAddressUtils.isUnalteredOrReversePathOrSender(SpecialAddress.RECIPIENTS);
 
         assertThat(unalteredOrReversePathOrSender).isFalse();
     }
 
     @Test
-    public void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsSpecialReplyTo() {
+    void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsSpecialReplyTo() {
         boolean unalteredOrReversePathOrSender = MailAddressUtils.isUnalteredOrReversePathOrSender(SpecialAddress.REPLY_TO);
 
         assertThat(unalteredOrReversePathOrSender).isFalse();
     }
 
     @Test
-    public void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsSpecialTo() {
+    void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsSpecialTo() {
         boolean unalteredOrReversePathOrSender = MailAddressUtils.isUnalteredOrReversePathOrSender(SpecialAddress.TO);
 
         assertThat(unalteredOrReversePathOrSender).isFalse();
     }
 
     @Test
-    public void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsNotSpecial() throws Exception {
+    void isUnalteredOrReversePathOrSenderShouldReturnFalseWhenMailAddressIsNotSpecial() throws Exception {
         boolean unalteredOrReversePathOrSender = MailAddressUtils.isUnalteredOrReversePathOrSender(new MailAddress("common", "james.org"));
 
         assertThat(unalteredOrReversePathOrSender).isFalse();
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SpecialAddressesUtilsTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SpecialAddressesUtilsTest.java
index 55b288d..cb8668c 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SpecialAddressesUtilsTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SpecialAddressesUtilsTest.java
@@ -19,6 +19,7 @@
 package org.apache.james.transport.util;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -37,23 +38,18 @@ import org.apache.james.util.MimeMessageUtil;
 import org.apache.mailet.MailetContext;
 import org.apache.mailet.base.MailAddressFixture;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
 public class SpecialAddressesUtilsTest {
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private MailAddress postmaster;
     private SpecialAddressesUtils testee;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    void setup() throws Exception {
         final MailetContext mailetContext = mock(MailetContext.class);
         postmaster = new MailAddress("postmaster@james.org");
         when(mailetContext.getPostmaster())
@@ -66,7 +62,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnEmptyWhenEmptyList() throws Exception {
+    void replaceMailAddressesShouldReturnEmptyWhenEmptyList() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -77,7 +73,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnSameContentWhenAddressesDoesntMatchAddressMarkerDomain() throws Exception {
+    void replaceMailAddressesShouldReturnSameContentWhenAddressesDoesntMatchAddressMarkerDomain() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -92,7 +88,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnSenderWhenAddressesMatchSender() throws Exception {
+    void replaceMailAddressesShouldReturnSenderWhenAddressesMatchSender() throws Exception {
         MailAddress sender = MailAddressFixture.ANY_AT_JAMES;
         FakeMail mail = FakeMail.builder()
                 .name("name")
@@ -105,7 +101,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnSenderWhenAddressesMatchFrom() throws Exception {
+    void replaceMailAddressesShouldReturnSenderWhenAddressesMatchFrom() throws Exception {
         MailAddress sender = MailAddressFixture.ANY_AT_JAMES;
         FakeMail mail = FakeMail.builder()
                 .name("name")
@@ -118,7 +114,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnEmptyWhenAddressesMatchSenderAndSenderIsNull() throws Exception {
+    void replaceMailAddressesShouldReturnEmptyWhenAddressesMatchSenderAndSenderIsNull() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -129,7 +125,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnEmptyWhenAddressesMatchReplyToAndReplyToIsNull() throws Exception {
+    void replaceMailAddressesShouldReturnEmptyWhenAddressesMatchReplyToAndReplyToIsNull() throws Exception {
         FakeMail mail = FakeMail.from(MimeMessageBuilder.mimeMessageBuilder());
 
         Collection<MailAddress> addresses = testee.replaceSpecialAddresses(mail, ImmutableList.of(SpecialAddress.REPLY_TO));
@@ -138,7 +134,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnReplyToWhenAddressesMatchReplyTo() throws Exception {
+    void replaceMailAddressesShouldReturnReplyToWhenAddressesMatchReplyTo() throws Exception {
         MimeMessage message = MimeMessageUtil.defaultMimeMessage();
         message.setReplyTo(InternetAddress.parse(MailAddressFixture.ANY_AT_JAMES.toString() + ", " + MailAddressFixture.OTHER_AT_JAMES.toString()));
         FakeMail mail = FakeMail.from(message);
@@ -152,7 +148,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnSenderWhenAddressesMatchReplyToAndNoReplyTo() throws Exception {
+    void replaceMailAddressesShouldReturnSenderWhenAddressesMatchReplyToAndNoReplyTo() throws Exception {
         MailAddress sender = MailAddressFixture.ANY_AT_JAMES;
         FakeMail mail = FakeMail.builder()
                 .name("name")
@@ -166,7 +162,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnSenderWhenAddressesMatchReversePath() throws Exception {
+    void replaceMailAddressesShouldReturnSenderWhenAddressesMatchReversePath() throws Exception {
         MailAddress sender = MailAddressFixture.ANY_AT_JAMES;
         FakeMail mail = FakeMail.builder()
                 .name("name")
@@ -179,7 +175,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnEmptyWhenAddressesMatchReversePathAndNoSender() throws Exception {
+    void replaceMailAddressesShouldReturnEmptyWhenAddressesMatchReversePathAndNoSender() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -190,7 +186,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnRecipientsWhenAddressesMatchRecipients() throws Exception {
+    void replaceMailAddressesShouldReturnRecipientsWhenAddressesMatchRecipients() throws Exception {
         MailAddress recipient = MailAddressFixture.ANY_AT_JAMES;
         MailAddress recipient2 = MailAddressFixture.OTHER_AT_JAMES;
         FakeMail mail = FakeMail.builder()
@@ -204,7 +200,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnRecipientsWhenAddressesMatchTo() throws Exception {
+    void replaceMailAddressesShouldReturnRecipientsWhenAddressesMatchTo() throws Exception {
         MailAddress recipient = MailAddressFixture.ANY_AT_JAMES;
         MailAddress recipient2 = MailAddressFixture.OTHER_AT_JAMES;
         FakeMail mail = FakeMail.builder()
@@ -218,7 +214,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnEmptyWhenAddressesMatchUnaltered() throws Exception {
+    void replaceMailAddressesShouldReturnEmptyWhenAddressesMatchUnaltered() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -229,7 +225,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnEmptyWhenAddressesMatchNull() throws Exception {
+    void replaceMailAddressesShouldReturnEmptyWhenAddressesMatchNull() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -240,7 +236,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnSameAddressWhenAddressesDoesntMatch() throws Exception {
+    void replaceMailAddressesShouldReturnSameAddressWhenAddressesDoesntMatch() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -253,7 +249,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceMailAddressesShouldReturnSameListWhenAddressesMatchDelete() throws Exception {
+    void replaceMailAddressesShouldReturnSameListWhenAddressesMatchDelete() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -265,7 +261,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnEmptyWhenEmptyList() throws Exception {
+    void replaceInternetAddressesShouldReturnEmptyWhenEmptyList() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -276,7 +272,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnSameContentWhenAddressesDoesntMatchAddressMarkerDomain() throws Exception {
+    void replaceInternetAddressesShouldReturnSameContentWhenAddressesDoesntMatchAddressMarkerDomain() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -291,7 +287,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnSenderWhenAddressesMatchSender() throws Exception {
+    void replaceInternetAddressesShouldReturnSenderWhenAddressesMatchSender() throws Exception {
         MailAddress sender = MailAddressFixture.ANY_AT_JAMES;
         FakeMail mail = FakeMail.builder()
                 .name("name")
@@ -304,7 +300,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnFromWhenAddressesMatchFrom() throws Exception {
+    void replaceInternetAddressesShouldReturnFromWhenAddressesMatchFrom() throws Exception {
         MailAddress from = MailAddressFixture.ANY_AT_JAMES;
         MailAddress from2 = MailAddressFixture.OTHER_AT_JAMES;
         FakeMail mail = FakeMail.from(MimeMessageBuilder.mimeMessageBuilder()
@@ -316,7 +312,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnSenderWhenAddressesMatchFromAndNoFrom() throws Exception {
+    void replaceInternetAddressesShouldReturnSenderWhenAddressesMatchFromAndNoFrom() throws Exception {
         MailAddress sender = MailAddressFixture.ANY_AT_JAMES;
         FakeMail mail = FakeMail.builder()
                 .name("name")
@@ -330,7 +326,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnEmptyWhenAddressesMatchSenderAndSenderIsNull() throws Exception {
+    void replaceInternetAddressesShouldReturnEmptyWhenAddressesMatchSenderAndSenderIsNull() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -341,7 +337,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnEmptyWhenAddressesMatchReplyToAndReplyToIsNull() throws Exception {
+    void replaceInternetAddressesShouldReturnEmptyWhenAddressesMatchReplyToAndReplyToIsNull() throws Exception {
         FakeMail mail = FakeMail.from(MimeMessageBuilder.mimeMessageBuilder());
 
         List<MailAddress> addresses = testee.replaceInternetAddresses(mail, ImmutableList.of(SpecialAddress.REPLY_TO.toInternetAddress()));
@@ -350,7 +346,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnReplyToWhenAddressesMatchReplyTo() throws Exception {
+    void replaceInternetAddressesShouldReturnReplyToWhenAddressesMatchReplyTo() throws Exception {
         MimeMessage message = MimeMessageUtil.defaultMimeMessage();
         message.setReplyTo(InternetAddress.parse(MailAddressFixture.ANY_AT_JAMES.toString() + ", " + MailAddressFixture.OTHER_AT_JAMES.toString()));
         FakeMail mail = FakeMail.from(message);
@@ -364,7 +360,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnSenderWhenAddressesMatchReplyToAndNoReplyTo() throws Exception {
+    void replaceInternetAddressesShouldReturnSenderWhenAddressesMatchReplyToAndNoReplyTo() throws Exception {
         MailAddress sender = MailAddressFixture.ANY_AT_JAMES;
         FakeMail mail = FakeMail.builder()
                 .name("name")
@@ -378,7 +374,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnSenderWhenAddressesMatchReversePath() throws Exception {
+    void replaceInternetAddressesShouldReturnSenderWhenAddressesMatchReversePath() throws Exception {
         MailAddress sender = MailAddressFixture.ANY_AT_JAMES;
         FakeMail mail = FakeMail.builder()
                 .name("name")
@@ -391,7 +387,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnEmptyWhenAddressesMatchReversePathAndNoSender() throws Exception {
+    void replaceInternetAddressesShouldReturnEmptyWhenAddressesMatchReversePathAndNoSender() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -402,7 +398,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnToWhenAddressesMatchRecipients() throws Exception {
+    void replaceInternetAddressesShouldReturnToWhenAddressesMatchRecipients() throws Exception {
         MailAddress to = MailAddressFixture.ANY_AT_JAMES;
         MailAddress to2 = MailAddressFixture.OTHER_AT_JAMES;
         FakeMail mail = FakeMail.from(MimeMessageBuilder.mimeMessageBuilder()
@@ -414,7 +410,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnToWhenAddressesMatchTo() throws Exception {
+    void replaceInternetAddressesShouldReturnToWhenAddressesMatchTo() throws Exception {
         MailAddress to = MailAddressFixture.ANY_AT_JAMES;
         MailAddress to2 = MailAddressFixture.OTHER_AT_JAMES;
         FakeMail mail = FakeMail.from(MimeMessageBuilder.mimeMessageBuilder()
@@ -426,7 +422,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnEmptyWhenAddressesMatchUnaltered() throws Exception {
+    void replaceInternetAddressesShouldReturnEmptyWhenAddressesMatchUnaltered() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -437,7 +433,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnEmptyWhenAddressesMatchNull() throws Exception {
+    void replaceInternetAddressesShouldReturnEmptyWhenAddressesMatchNull() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -448,7 +444,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnSameAddressWhenAddressesDoesntMatch() throws Exception {
+    void replaceInternetAddressesShouldReturnSameAddressWhenAddressesDoesntMatch() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -461,7 +457,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void replaceInternetAddressesShouldReturnSameListWhenAddressesMatchDelete() throws Exception {
+    void replaceInternetAddressesShouldReturnSameListWhenAddressesMatchDelete() throws Exception {
         FakeMail mail = FakeMail.builder()
                 .name("name")
                 .build();
@@ -473,27 +469,27 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void getFirstSpecialAddressIfMatchingOrGivenAddressShouldThrowWhenSenderInitParameterIsNull() throws Exception {
-        expectedException.expect(NullPointerException.class);
-        testee.getFirstSpecialAddressIfMatchingOrGivenAddress(null, ImmutableList.of("postmaster", "sender", "unaltered"));
+    void getFirstSpecialAddressIfMatchingOrGivenAddressShouldThrowWhenSenderInitParameterIsNull() throws Exception {
+        assertThatThrownBy(() -> testee.getFirstSpecialAddressIfMatchingOrGivenAddress(null, ImmutableList.of("postmaster", "sender", "unaltered")))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnAbsentWhenSenderInitParameterIsAbsent() throws Exception {
+    void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnAbsentWhenSenderInitParameterIsAbsent() throws Exception {
         Optional<MailAddress> sender = testee.getFirstSpecialAddressIfMatchingOrGivenAddress(Optional.empty(), ImmutableList.of("postmaster", "sender", "unaltered"));
 
         assertThat(sender).isEmpty();
     }
 
     @Test
-    public void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnAbsentWhenSenderInitParameterIsEmpty() throws Exception {
+    void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnAbsentWhenSenderInitParameterIsEmpty() throws Exception {
         Optional<MailAddress> sender = testee.getFirstSpecialAddressIfMatchingOrGivenAddress(Optional.of(""), ImmutableList.of("postmaster", "sender", "unaltered"));
 
         assertThat(sender).isEmpty();
     }
 
     @Test
-    public void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnGivenAddressWhenNoSpecialAddressMatches() throws Exception {
+    void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnGivenAddressWhenNoSpecialAddressMatches() throws Exception {
         Optional<MailAddress> sender = testee.getFirstSpecialAddressIfMatchingOrGivenAddress(Optional.of("test@james.org"), ImmutableList.of("postmaster", "sender", "unaltered"));
 
         MailAddress expectedMailAddress = new MailAddress("test", "james.org");
@@ -501,14 +497,14 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnFirstSpecialAddressWhenMatching() throws Exception {
+    void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnFirstSpecialAddressWhenMatching() throws Exception {
         Optional<MailAddress> sender = testee.getFirstSpecialAddressIfMatchingOrGivenAddress(Optional.of("postmaster"), ImmutableList.of("postmaster", "sender", "unaltered"));
 
         assertThat(sender).contains(postmaster);
     }
 
     @Test
-    public void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnSecondSpecialAddressWhenMatching() throws Exception {
+    void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnSecondSpecialAddressWhenMatching() throws Exception {
         Optional<MailAddress> sender = testee.getFirstSpecialAddressIfMatchingOrGivenAddress(Optional.of("sender"), ImmutableList.of("postmaster", "sender", "unaltered"));
 
         MailAddress expectedMailAddress = SpecialAddress.SENDER;
@@ -516,7 +512,7 @@ public class SpecialAddressesUtilsTest {
     }
 
     @Test
-    public void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnLastSpecialAddressWhenMatching() throws Exception {
+    void getFirstSpecialAddressIfMatchingOrGivenAddressShouldReturnLastSpecialAddressWhenMatching() throws Exception {
         Optional<MailAddress> sender = testee.getFirstSpecialAddressIfMatchingOrGivenAddress(Optional.of("unaltered"), ImmutableList.of("postmaster", "sender", "unaltered"));
 
         MailAddress expectedMailAddress = SpecialAddress.UNALTERED;


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org