You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/01/21 06:42:27 UTC

[james-project] 01/02: JAMES-3431 Migrate Mailet integration tests to JUNIT 5

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

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

commit b8960c53e4fdbbc8e87b4202d4aafe0a271aca0b
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue Jan 19 11:19:10 2021 +0700

    JAMES-3431 Migrate Mailet integration tests to JUNIT 5
---
 .../james/mailets/AddDeliveredToHeaderTest.java    |  26 ++---
 .../james/mailets/BounceIntegrationTest.java       |  57 ++++++-----
 .../mailets/CommonMailetConfigurationTest.java     |  25 +++--
 .../apache/james/mailets/DKIMIntegrationTest.java  |  25 +++--
 ...ectResolutionRemoteDeliveryIntegrationTest.java |  47 +++++----
 .../GatewayRemoteDeliveryIntegrationTest.java      |  53 +++++-----
 .../org/apache/james/mailets/MailetErrorsTest.java | 108 ++++++++++-----------
 .../mailets/NetworkMatcherIntegrationTest.java     |  54 +++++------
 .../RecipientRewriteTableIntegrationTest.java      |  26 ++---
 .../james/mailets/RemoteDeliveryErrorTest.java     |  34 +++----
 .../mailets/SenderIsLocalIntegrationTest.java      |  26 ++---
 .../org/apache/james/mailets/SieveDelivery.java    |  26 ++---
 .../mailets/SizeGreaterThanIntegrationTest.java    |  26 ++---
 .../james/mailets/SmtpAuthIntegrationTest.java     |  26 ++---
 .../configuration/MailetConfigurationTest.java     |  23 ++---
 .../configuration/SmtpConfigurationTest.java       |   2 +-
 .../crypto/SMIMEDecryptIntegrationTest.java        |  26 +++--
 .../mailets/crypto/SMIMESignIntegrationTest.java   |  27 +++---
 .../java/org/apache/james/smtp/DSNRelayTest.java   |  34 +++----
 .../james/smtp/SmtpAuthorizedAddressesTest.java    |  41 ++++----
 .../james/smtp/SmtpBracketEnforcementTest.java     |  36 +++----
 .../org/apache/james/smtp/SmtpContentTypeTest.java |  33 +++----
 .../james/smtp/SmtpIdentityVerificationTest.java   |  32 +++---
 .../org/apache/james/smtp/SmtpNullSenderTest.java  |  26 ++---
 .../apache/james/smtp/SmtpRandomStoringTest.java   |  27 +++---
 .../apache/james/smtp/SmtpSizeLimitationTest.java  |  28 +++---
 .../james/smtp/extensions/SMTPHeloHooksTest.java   |  52 +++++-----
 .../james/smtp/extensions/StaticInputChecker.java  |   7 +-
 .../james/transport/mailets/AddFooterTest.java     |  28 +++---
 .../james/transport/mailets/AliasMappingTest.java  |  26 ++---
 .../mailets/AmqpForwardAttachmentTest.java         |  46 ++++-----
 .../transport/mailets/ContactExtractorTest.java    |  43 ++++----
 .../transport/mailets/DlpIntegrationTest.java      |  43 ++++----
 .../james/transport/mailets/DomainMappingTest.java |  26 ++---
 .../transport/mailets/GroupMappingRelayTest.java   |  30 +++---
 .../james/transport/mailets/GroupMappingTest.java  |  26 ++---
 .../mailets/ICSAttachmentWorkflowTest.java         |  61 +++++-------
 .../transport/mailets/IsOverQuotaMatcherTest.java  |  26 ++---
 .../mailets/MailReprocessingIntegrationTest.java   |  25 +++--
 .../mailets/SpamAssassinIntegrationTest.java       |  29 +++---
 .../transport/mailets/StripAttachmentTest.java     |  26 ++---
 .../mailets/ToRepositoryIntegrationTest.java       |  26 ++---
 .../ToSenderDomainRepositoryIntegrationTest.java   |  46 ++++-----
 .../amqp/{AmqpRule.java => AmqpExtension.java}     |  47 ++++++---
 .../apache/james/util/docker/DockerContainer.java  |  14 ++-
 .../main/java/org/apache/james/utils/FakeSmtp.java |  21 +++-
 46 files changed, 765 insertions(+), 777 deletions(-)

diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/AddDeliveredToHeaderTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/AddDeliveredToHeaderTest.java
index 4591e31..f56dca4 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/AddDeliveredToHeaderTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/AddDeliveredToHeaderTest.java
@@ -27,6 +27,8 @@ import static org.apache.james.mailets.configuration.Constants.RECIPIENT;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import org.apache.james.modules.protocols.ImapGuiceProbe;
 import org.apache.james.modules.protocols.SmtpGuiceProbe;
 import org.apache.james.probe.DataProbe;
@@ -34,25 +36,23 @@ import org.apache.james.transport.mailets.AddDeliveredToHeader;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class AddDeliveredToHeaderTest {
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    @Before
-    public void setup() throws Exception {
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder.newFolder());
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
+        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -60,7 +60,7 @@ public class AddDeliveredToHeaderTest {
         dataProbe.addUser(RECIPIENT, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java
index aea61c4..43e337b 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/BounceIntegrationTest.java
@@ -26,6 +26,7 @@ import static org.apache.james.mailets.configuration.Constants.RECIPIENT;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
 import java.util.Arrays;
 
 import javax.mail.internet.MimeMessage;
@@ -52,10 +53,10 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
 import org.apache.mailet.Mailet;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class BounceIntegrationTest {
     public static final String POSTMASTER = "postmaster@" + DEFAULT_DOMAIN;
@@ -65,23 +66,21 @@ public class BounceIntegrationTest {
     public static final String OTHER = "other@" + DEFAULT_DOMAIN;
     public static final String OTHER_PASSWORD = "otherSecret";
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
 
     @Test
-    public void dsnBounceMailetShouldDeliverBounce() throws Exception {
-        setup(DSNBounce.class);
+    public void dsnBounceMailetShouldDeliverBounce(@TempDir File temporaryFolder) throws Exception {
+        setup(temporaryFolder, DSNBounce.class);
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
             .sendMessage(SENDER, RECIPIENT);
@@ -93,8 +92,8 @@ public class BounceIntegrationTest {
     }
 
     @Test
-    public void dsnBounceMailetShouldDeliverBounceToTheMailFromAddress() throws Exception {
-        setup(DSNBounce.class);
+    public void dsnBounceMailetShouldDeliverBounceToTheMailFromAddress(@TempDir File temporaryFolder) throws Exception {
+        setup(temporaryFolder, DSNBounce.class);
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
             .sendMessageWithHeaders(SENDER, RECIPIENT,
@@ -112,8 +111,8 @@ public class BounceIntegrationTest {
     }
 
     @Test
-    public void dsnBounceMailetBouncedMailShouldBeAdressedToTheSenderInEnvelopeAndHeader() throws Exception {
-        setup(DSNBounce.class);
+    public void dsnBounceMailetBouncedMailShouldBeAdressedToTheSenderInEnvelopeAndHeader(@TempDir File temporaryFolder) throws Exception {
+        setup(temporaryFolder, DSNBounce.class);
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
             .sendMessageWithHeaders(SENDER, RECIPIENT,
@@ -132,7 +131,7 @@ public class BounceIntegrationTest {
         assertThat(mimeMessage.getHeader("To")[0]).isEqualTo(SENDER);
     }
 
-    private void setup(Class<? extends Mailet> mailet, Pair<String, String>... additionalProperties) throws Exception {
+    private void setup(File tempDir, Class<? extends Mailet> mailet, Pair<String, String>... additionalProperties) throws Exception {
         MailetConfiguration.Builder mailetConfiguration = MailetConfiguration.builder()
                 .matcher(All.class)
                 .mailet(mailet)
@@ -145,7 +144,7 @@ public class BounceIntegrationTest {
                 .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
                 .withMailetContainer(
                         generateMailetContainerConfiguration(mailetConfiguration))
-                .build(temporaryFolder.newFolder());
+                .build(tempDir);
         jamesServer.start();
 
         jamesServer.getProbe(DataProbeImpl.class)
@@ -158,8 +157,8 @@ public class BounceIntegrationTest {
     }
 
     @Test
-    public void bounceMailetShouldDeliverBounce() throws Exception {
-        setup(Bounce.class);
+    public void bounceMailetShouldDeliverBounce(@TempDir File temporaryFolder) throws Exception {
+        setup(temporaryFolder, Bounce.class);
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
             .sendMessage(SENDER, RECIPIENT);
@@ -171,8 +170,8 @@ public class BounceIntegrationTest {
     }
 
     @Test
-    public void forwardMailetShouldDeliverBounce() throws Exception {
-        setup(Forward.class, Pair.of("forwardTo", SENDER));
+    public void forwardMailetShouldDeliverBounce(@TempDir File temporaryFolder) throws Exception {
+        setup(temporaryFolder, Forward.class, Pair.of("forwardTo", SENDER));
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
             .sendMessage("any@" + DEFAULT_DOMAIN, RECIPIENT);
@@ -184,8 +183,8 @@ public class BounceIntegrationTest {
     }
 
     @Test
-    public void redirectMailetShouldDeliverBounce() throws Exception {
-        setup(Redirect.class, Pair.of("recipients", SENDER));
+    public void redirectMailetShouldDeliverBounce(@TempDir File temporaryFolder) throws Exception {
+        setup(temporaryFolder, Redirect.class, Pair.of("recipients", SENDER));
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
             .sendMessage("any@" + DEFAULT_DOMAIN, RECIPIENT);
@@ -197,8 +196,8 @@ public class BounceIntegrationTest {
     }
 
     @Test
-    public void resendMailetShouldDeliverBounce() throws Exception {
-        setup(Resend.class, Pair.of("recipients", SENDER));
+    public void resendMailetShouldDeliverBounce(@TempDir File temporaryFolder) throws Exception {
+        setup(temporaryFolder, Resend.class, Pair.of("recipients", SENDER));
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
             .sendMessage("any@" + DEFAULT_DOMAIN, RECIPIENT);
@@ -210,8 +209,8 @@ public class BounceIntegrationTest {
     }
 
     @Test
-    public void notifySenderMailetShouldDeliverBounce() throws Exception {
-        setup(NotifySender.class);
+    public void notifySenderMailetShouldDeliverBounce(@TempDir File temporaryFolder) throws Exception {
+        setup(temporaryFolder, NotifySender.class);
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
             .sendMessage(SENDER, RECIPIENT);
@@ -223,8 +222,8 @@ public class BounceIntegrationTest {
     }
 
     @Test
-    public void notifyPostmasterMailetShouldDeliverBounce() throws Exception {
-        setup(NotifyPostmaster.class);
+    public void notifyPostmasterMailetShouldDeliverBounce(@TempDir File temporaryFolder) throws Exception {
+        setup(temporaryFolder, NotifyPostmaster.class);
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
             .sendMessage("any@" + DEFAULT_DOMAIN, RECIPIENT);
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java
index a2694a9..26984c2 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/CommonMailetConfigurationTest.java
@@ -26,6 +26,7 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.RECIPIENT;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 
+import java.io.File;
 import java.util.Locale;
 
 import org.apache.james.modules.protocols.ImapGuiceProbe;
@@ -34,25 +35,23 @@ import org.apache.james.probe.DataProbe;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class CommonMailetConfigurationTest {
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    @Before
-    public void setup() throws Exception {
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder.newFolder());
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
+        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -60,7 +59,7 @@ public class CommonMailetConfigurationTest {
         dataProbe.addUser(RECIPIENT, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DKIMIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DKIMIntegrationTest.java
index 0b2dc92..19ce6e3 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DKIMIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DKIMIntegrationTest.java
@@ -25,6 +25,7 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
@@ -46,11 +47,11 @@ import org.apache.james.transport.matchers.All;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class DKIMIntegrationTest {
 
@@ -99,18 +100,16 @@ public class DKIMIntegrationTest {
             "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDYDaYKXzwVYwqWbLhmuJ66aTAN8wmDR+rfHE8HfnkSOax0oIoTM5zquZrTLo30870YMfYzxwfB6j/Nz3QdwrUD/t0YMYJiUKyWJnCKfZXHJBJ+yfRHr7oW+UW3cVo9CG2bBfIxsInwYe175g9UjyntJpWueqdEIo1c2bhv9Mp66QIDAQAB;",
             "selector", "example.com");
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
     private List<Optional<String>> dkimAuthResults;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         dkimAuthResults = new ArrayList<>();
         ExtractAttributeStub.setDkimAuthResultInspector(value -> dkimAuthResults.add(value.map(result -> (String) result)));
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.simpleMailetContainerConfiguration()
@@ -125,7 +124,7 @@ public class DKIMIntegrationTest {
             .withBase(MemoryJamesServerMain.IN_MEMORY_SERVER_AGGREGATE_MODULE)
             .withOverrides(binder -> binder.bind(PublicKeyRecordRetriever.class).toInstance(MOCK_PUBLIC_KEY_RECORD_RETRIEVER))
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -134,7 +133,7 @@ public class DKIMIntegrationTest {
         dataProbe.addUser(RECIPIENT, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DirectResolutionRemoteDeliveryIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DirectResolutionRemoteDeliveryIntegrationTest.java
index cdd54c2..90693a8 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DirectResolutionRemoteDeliveryIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/DirectResolutionRemoteDeliveryIntegrationTest.java
@@ -29,6 +29,7 @@ import static org.apache.james.mailets.configuration.MailetConfiguration.LOCAL_D
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.hasSize;
 
+import java.io.File;
 import java.net.InetAddress;
 import java.util.List;
 
@@ -46,12 +47,11 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.FakeSmtp;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import com.google.common.collect.ImmutableList;
 
@@ -67,30 +67,27 @@ public class DirectResolutionRemoteDeliveryIntegrationTest {
     private static final ImmutableList<InetAddress> ADDRESS_EMPTY_LIST = ImmutableList.of();
     private static final ImmutableList<String> RECORD_EMPTY_LIST = ImmutableList.of();
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
-    @ClassRule
+    @RegisterExtension
     public static FakeSmtp fakeSmtp = FakeSmtp.withDefaultPort();
-    @ClassRule
+    @RegisterExtension
     public static FakeSmtp fakeSmtpOnPort26 = FakeSmtp.withSmtpPort(26);
 
     private TemporaryJamesServer jamesServer;
     private DataProbe dataProbe;
 
-    @After
+    @AfterEach
     public void tearDown() {
-        fakeSmtp.clean();
         if (jamesServer != null) {
             jamesServer.shutdown();
         }
     }
 
     @Test
-    public void directResolutionShouldBeWellPerformed() throws Exception {
+    public void directResolutionShouldBeWellPerformed(@TempDir File temporaryFolder) throws Exception {
         InMemoryDNSService inMemoryDNSService = new InMemoryDNSService()
             .registerMxRecord(JAMES_ANOTHER_DOMAIN, fakeSmtp.getContainer().getContainerIp());
 
@@ -100,7 +97,7 @@ public class DirectResolutionRemoteDeliveryIntegrationTest {
             .withMailetContainer(TemporaryJamesServer.simpleMailetContainerConfiguration()
                 .putProcessor(directResolutionTransport())
                 .putProcessor(CommonProcessors.bounces()))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -115,7 +112,7 @@ public class DirectResolutionRemoteDeliveryIntegrationTest {
     }
 
     @Test
-    public void directResolutionShouldFailoverOnSecondMxWhenFirstMxFailed() throws Exception {
+    public void directResolutionShouldFailoverOnSecondMxWhenFirstMxFailed(@TempDir File temporaryFolder) throws Exception {
         InMemoryDNSService inMemoryDNSService = new InMemoryDNSService()
             .registerRecord(JAMES_ANOTHER_DOMAIN, ADDRESS_EMPTY_LIST, JAMES_ANOTHER_MX_DOMAINS, RECORD_EMPTY_LIST)
             .registerMxRecord(JAMES_ANOTHER_MX_DOMAIN_1, fakeSmtpOnPort26.getContainer().getContainerIp())
@@ -127,7 +124,7 @@ public class DirectResolutionRemoteDeliveryIntegrationTest {
             .withMailetContainer(TemporaryJamesServer.simpleMailetContainerConfiguration()
                 .putProcessor(directResolutionTransport())
                 .putProcessor(CommonProcessors.bounces()))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -142,7 +139,7 @@ public class DirectResolutionRemoteDeliveryIntegrationTest {
     }
 
     @Test
-    public void directResolutionShouldBounceUponUnreachableMxRecords() throws Exception {
+    public void directResolutionShouldBounceUponUnreachableMxRecords(@TempDir File temporaryFolder) throws Exception {
         InMemoryDNSService inMemoryDNSService = new InMemoryDNSService()
             .registerRecord(JAMES_ANOTHER_DOMAIN, ADDRESS_EMPTY_LIST, ImmutableList.of("unknown"), RECORD_EMPTY_LIST);
 
@@ -152,7 +149,7 @@ public class DirectResolutionRemoteDeliveryIntegrationTest {
             .withMailetContainer(TemporaryJamesServer.simpleMailetContainerConfiguration()
                 .putProcessor(transport())
                 .putProcessor(CommonProcessors.bounces()))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -169,7 +166,7 @@ public class DirectResolutionRemoteDeliveryIntegrationTest {
     }
 
     @Test
-    public void directResolutionShouldBounceWhenNoMxRecord() throws Exception {
+    public void directResolutionShouldBounceWhenNoMxRecord(@TempDir File temporaryFolder) throws Exception {
         InMemoryDNSService inMemoryDNSService = new InMemoryDNSService()
             .registerRecord(JAMES_ANOTHER_DOMAIN, ADDRESS_EMPTY_LIST, RECORD_EMPTY_LIST, RECORD_EMPTY_LIST);
 
@@ -179,7 +176,7 @@ public class DirectResolutionRemoteDeliveryIntegrationTest {
             .withMailetContainer(TemporaryJamesServer.simpleMailetContainerConfiguration()
                 .putProcessor(transport())
                 .putProcessor(CommonProcessors.bounces()))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -195,9 +192,9 @@ public class DirectResolutionRemoteDeliveryIntegrationTest {
             .awaitMessage(awaitAtMostOneMinute);
     }
 
-    @Ignore("JAMES-2913 PerRecipientHeaders are not handled by RemoteDelivery")
+    @Disabled("JAMES-2913 PerRecipientHeaders are not handled by RemoteDelivery")
     @Test
-    public void remoteDeliveryShouldAddPerRecipientHeaders() throws Exception {
+    public void remoteDeliveryShouldAddPerRecipientHeaders(@TempDir File temporaryFolder) throws Exception {
         InMemoryDNSService inMemoryDNSService = new InMemoryDNSService()
             .registerMxRecord(JAMES_ANOTHER_DOMAIN, fakeSmtp.getContainer().getContainerIp());
 
@@ -215,7 +212,7 @@ public class DirectResolutionRemoteDeliveryIntegrationTest {
                     .addMailet(MailetConfiguration.remoteDeliveryBuilder()
                         .matcher(All.class)))
                 .putProcessor(CommonProcessors.bounces()))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
index b2ad4d9..a9f3dbf 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/GatewayRemoteDeliveryIntegrationTest.java
@@ -28,6 +28,8 @@ import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMin
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.hasSize;
 
+import java.io.File;
+
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.InMemoryDNSService;
 import org.apache.james.mailets.configuration.CommonProcessors;
@@ -42,12 +44,11 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.FakeSmtp;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class GatewayRemoteDeliveryIntegrationTest {
     private static final String JAMES_ANOTHER_DOMAIN = "james.com";
@@ -55,26 +56,24 @@ public class GatewayRemoteDeliveryIntegrationTest {
     private static final String FROM = "from@" + DEFAULT_DOMAIN;
     private static final String RECIPIENT = "touser@" + JAMES_ANOTHER_DOMAIN;
 
-    @ClassRule
+    @RegisterExtension
     public static FakeSmtp fakeSmtp = FakeSmtp.withDefaultPort();
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
     private DataProbe dataProbe;
     private InMemoryDNSService inMemoryDNSService;
 
-    @Before
+    @BeforeEach
     public void setup() throws Exception {
         inMemoryDNSService = new InMemoryDNSService()
             .registerMxRecord(JAMES_ANOTHER_DOMAIN, fakeSmtp.getContainer().getContainerIp());
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         fakeSmtp.clean();
         if (jamesServer != null) {
@@ -83,13 +82,13 @@ public class GatewayRemoteDeliveryIntegrationTest {
     }
 
     @Test
-    public void outgoingMailShouldTransitThroughGatewayWhenNoPort() throws Exception {
+    public void outgoingMailShouldTransitThroughGatewayWhenNoPort(@TempDir File temporaryFolder) throws Exception {
         String gatewayProperty = fakeSmtp.getContainer().getContainerIp();
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(generateMailetContainerConfiguration(gatewayProperty))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -104,13 +103,13 @@ public class GatewayRemoteDeliveryIntegrationTest {
     }
 
     @Test
-    public void outgoingMailShouldTransitThroughGatewayWhenPort() throws Exception {
+    public void outgoingMailShouldTransitThroughGatewayWhenPort(@TempDir File temporaryFolder) throws Exception {
         String gatewayProperty = fakeSmtp.getContainer().getContainerIp() + ":25";
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(generateMailetContainerConfiguration(gatewayProperty))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -124,13 +123,13 @@ public class GatewayRemoteDeliveryIntegrationTest {
     }
 
     @Test
-    public void outgoingMailShouldTransitThroughGatewayWhenSeveralIps() throws Exception {
+    public void outgoingMailShouldTransitThroughGatewayWhenSeveralIps(@TempDir File temporaryFolder) throws Exception {
         String gatewayProperty = fakeSmtp.getContainer().getContainerIp() + ",invalid.domain";
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(generateMailetContainerConfiguration(gatewayProperty))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -145,13 +144,13 @@ public class GatewayRemoteDeliveryIntegrationTest {
     }
 
     @Test
-    public void outgoingMailShouldFallbackToSecondGatewayWhenFirstInvalid() throws Exception {
+    public void outgoingMailShouldFallbackToSecondGatewayWhenFirstInvalid(@TempDir File temporaryFolder) throws Exception {
         String gatewayProperty = "invalid.domain," + fakeSmtp.getContainer().getContainerIp();
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(generateMailetContainerConfiguration(gatewayProperty))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -166,14 +165,14 @@ public class GatewayRemoteDeliveryIntegrationTest {
     }
 
     @Test
-    public void outgoingMailShouldNotBeSentDirectlyToTheHostWhenGatewayFails() throws Exception {
+    public void outgoingMailShouldNotBeSentDirectlyToTheHostWhenGatewayFails(@TempDir File temporaryFolder) throws Exception {
         String gatewayProperty = "invalid.domain";
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_AND_IMAP_MODULE)
             .withOverrides(binder -> binder.bind(DNSService.class).toInstance(inMemoryDNSService))
             .withMailetContainer(generateMailetContainerConfiguration(gatewayProperty))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -192,14 +191,14 @@ public class GatewayRemoteDeliveryIntegrationTest {
     }
 
     @Test
-    public void remoteDeliveryShouldBounceUponFailure() throws Exception {
+    public void remoteDeliveryShouldBounceUponFailure(@TempDir File temporaryFolder) throws Exception {
         String gatewayProperty = "invalid.domain";
 
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_AND_IMAP_MODULE)
             .withOverrides(binder -> binder.bind(DNSService.class).toInstance(inMemoryDNSService))
             .withMailetContainer(generateMailetContainerConfiguration(gatewayProperty))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -216,7 +215,7 @@ public class GatewayRemoteDeliveryIntegrationTest {
     }
 
     @Test
-    public void remoteDeliveryShouldBounceUponFailureWhenNoBounceProcessor() throws Exception {
+    public void remoteDeliveryShouldBounceUponFailureWhenNoBounceProcessor(@TempDir File temporaryFolder) throws Exception {
         String gatewayProperty = "invalid.domain";
 
         jamesServer = TemporaryJamesServer.builder()
@@ -229,7 +228,7 @@ public class GatewayRemoteDeliveryIntegrationTest {
                     .addMailet(MailetConfiguration.remoteDeliveryBuilderNoBounces()
                         .matcher(All.class)
                         .addProperty("gateway", gatewayProperty))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/MailetErrorsTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/MailetErrorsTest.java
index f14aa8b..fe83f2d 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/MailetErrorsTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/MailetErrorsTest.java
@@ -26,6 +26,8 @@ import static org.apache.james.mailets.configuration.Constants.FROM;
 import static org.apache.james.mailets.configuration.Constants.LOCALHOST_IP;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 
+import java.io.File;
+
 import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
 import org.apache.james.mailets.configuration.MailetContainer;
@@ -48,23 +50,21 @@ import org.apache.james.transport.matchers.All;
 import org.apache.james.transport.matchers.HasException;
 import org.apache.james.utils.MailRepositoryProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class MailetErrorsTest {
     public static final String CUSTOM_PROCESSOR = "custom";
     public static final MailRepositoryUrl CUSTOM_REPOSITORY = MailRepositoryUrl.from("memory://var/mail/custom/");
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender smtpMessageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    @After
+    @AfterEach
     public void tearDown() {
         if (jamesServer != null) {
             jamesServer.shutdown();
@@ -72,7 +72,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void mailetProcessorsShouldHandleMessagingException() throws Exception {
+    public void mailetProcessorsShouldHandleMessagingException(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -82,7 +82,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(ErrorMailet.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -92,7 +92,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void mailetProcessingShouldHandleClassNotFoundException() throws Exception {
+    public void mailetProcessingShouldHandleClassNotFoundException(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -102,7 +102,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(NoClassDefFoundErrorMailet.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -112,7 +112,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void matcherProcessingShouldHandleClassNotFoundException() throws Exception {
+    public void matcherProcessingShouldHandleClassNotFoundException(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -122,7 +122,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(NoClassDefFoundErrorMatcher.class)
                         .mailet(Null.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -132,7 +132,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void mailetProcessorsShouldHandleRuntimeException() throws Exception {
+    public void mailetProcessorsShouldHandleRuntimeException(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -142,7 +142,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(RuntimeExceptionMailet.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -152,7 +152,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void spoolerShouldEventuallyProcessUponTemporaryError() throws Exception {
+    public void spoolerShouldEventuallyProcessUponTemporaryError(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -166,7 +166,7 @@ public class MailetErrorsTest {
                         .matcher(All.class)
                         .mailet(ToRepository.class)
                         .addProperty("repositoryPath", CUSTOM_REPOSITORY.asString()))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -176,7 +176,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void spoolerShouldEventuallyProcessMailsAfterThreadSuicide() throws Exception {
+    public void spoolerShouldEventuallyProcessMailsAfterThreadSuicide(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -190,7 +190,7 @@ public class MailetErrorsTest {
                         .matcher(All.class)
                         .mailet(ToRepository.class)
                         .addProperty("repositoryPath", CUSTOM_REPOSITORY.asString()))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -200,7 +200,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void spoolerShouldNotInfinitLoopUponPermanentError() throws Exception {
+    public void spoolerShouldNotInfinitLoopUponPermanentError(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -210,7 +210,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(RuntimeErrorMailet.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -220,7 +220,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void mailetProcessorsShouldHandleMessagingExceptionWhenSpecificErrorHandlingSpecified() throws Exception {
+    public void mailetProcessorsShouldHandleMessagingExceptionWhenSpecificErrorHandlingSpecified(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -232,7 +232,7 @@ public class MailetErrorsTest {
                         .matcher(All.class)
                         .mailet(ErrorMailet.class)
                         .addProperty("onMailetException", CUSTOM_PROCESSOR))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -243,7 +243,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void mailetProcessorsShouldHandleRuntimeExceptionWhenSpecificErrorHandlingSpecified() throws Exception {
+    public void mailetProcessorsShouldHandleRuntimeExceptionWhenSpecificErrorHandlingSpecified(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -255,7 +255,7 @@ public class MailetErrorsTest {
                         .matcher(All.class)
                         .mailet(RuntimeExceptionMailet.class)
                         .addProperty("onMailetException", CUSTOM_PROCESSOR))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -265,7 +265,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void onExceptionIgnoreShouldContinueProcessingWhenRuntimeException() throws Exception {
+    public void onExceptionIgnoreShouldContinueProcessingWhenRuntimeException(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -281,7 +281,7 @@ public class MailetErrorsTest {
                         .matcher(All.class)
                         .mailet(ToRepository.class)
                         .addProperty("repositoryPath", CUSTOM_REPOSITORY.asString()))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -291,7 +291,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void onExceptionIgnoreShouldContinueProcessingWhenMessagingException() throws Exception {
+    public void onExceptionIgnoreShouldContinueProcessingWhenMessagingException(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -307,7 +307,7 @@ public class MailetErrorsTest {
                         .matcher(All.class)
                         .mailet(ToRepository.class)
                         .addProperty("repositoryPath", CUSTOM_REPOSITORY.asString()))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -317,7 +317,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void matcherProcessorsShouldHandleMessagingException() throws Exception {
+    public void matcherProcessorsShouldHandleMessagingException(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -327,7 +327,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(ErrorMatcher.class)
                         .mailet(NoopMailet.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -337,7 +337,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void matcherProcessorsShouldHandleRuntimeException() throws Exception {
+    public void matcherProcessorsShouldHandleRuntimeException(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -347,7 +347,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(RuntimeExceptionMatcher.class)
                         .mailet(NoopMailet.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -357,7 +357,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void matcherProcessorsShouldHandleMessagingExceptionWhenSpecificErrorHandlingSpecified() throws Exception {
+    public void matcherProcessorsShouldHandleMessagingExceptionWhenSpecificErrorHandlingSpecified(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -369,7 +369,7 @@ public class MailetErrorsTest {
                         .matcher(ErrorMatcher.class)
                         .mailet(NoopMailet.class)
                         .addProperty("onMatchException", CUSTOM_PROCESSOR))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -379,7 +379,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void matcherProcessorsShouldHandleRuntimeExceptionWhenSpecificErrorHandlingSpecified() throws Exception {
+    public void matcherProcessorsShouldHandleRuntimeExceptionWhenSpecificErrorHandlingSpecified(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -391,7 +391,7 @@ public class MailetErrorsTest {
                         .matcher(RuntimeExceptionMatcher.class)
                         .mailet(NoopMailet.class)
                         .addProperty("onMatchException", CUSTOM_PROCESSOR))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -401,7 +401,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void onMatcherExceptionIgnoreShouldNotMatchWhenRuntimeExceptionAndNoMatchConfigured() throws Exception {
+    public void onMatcherExceptionIgnoreShouldNotMatchWhenRuntimeExceptionAndNoMatchConfigured(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -417,7 +417,7 @@ public class MailetErrorsTest {
                         .matcher(All.class)
                         .mailet(ToRepository.class)
                         .addProperty("repositoryPath", CUSTOM_REPOSITORY.asString()))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -427,7 +427,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void onMatcherExceptionIgnoreShouldNotMatchWhenMessagingExceptionAndNoMatchConfigured() throws Exception {
+    public void onMatcherExceptionIgnoreShouldNotMatchWhenMessagingExceptionAndNoMatchConfigured(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -443,7 +443,7 @@ public class MailetErrorsTest {
                         .matcher(All.class)
                         .mailet(ToRepository.class)
                         .addProperty("repositoryPath", CUSTOM_REPOSITORY.asString()))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -453,7 +453,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void onMatcherExceptionIgnoreShouldMatchWhenRuntimeExceptionAndAllMatchConfigured() throws Exception {
+    public void onMatcherExceptionIgnoreShouldMatchWhenRuntimeExceptionAndAllMatchConfigured(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -469,7 +469,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(Null.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -479,7 +479,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void onMatcherExceptionIgnoreShouldMatchWhenMessagingExceptionAndAllMatchConfigured() throws Exception {
+    public void onMatcherExceptionIgnoreShouldMatchWhenMessagingExceptionAndAllMatchConfigured(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -495,7 +495,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(Null.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -505,7 +505,7 @@ public class MailetErrorsTest {
     }
 
     @Test
-    public void hasExceptionMatcherShouldMatchWhenMatcherThrowsExceptionSpecified() throws Exception {
+    public void hasExceptionMatcherShouldMatchWhenMatcherThrowsExceptionSpecified(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -525,7 +525,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(ErrorMatcher.class)
                         .mailet(Null.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -535,7 +535,7 @@ public class MailetErrorsTest {
     }
     
     @Test
-    public void hasExceptionMatcherShouldNotMatchWhenMatcherThrowsExceptionNotSpecified() throws Exception {
+    public void hasExceptionMatcherShouldNotMatchWhenMatcherThrowsExceptionNotSpecified(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -555,7 +555,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(RuntimeExceptionMatcher.class)
                         .mailet(Null.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -565,7 +565,7 @@ public class MailetErrorsTest {
     }
     
     @Test
-    public void hasExceptionMatcherShouldMatchWhenMailetThrowsExceptionSpecified() throws Exception {
+    public void hasExceptionMatcherShouldMatchWhenMailetThrowsExceptionSpecified(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -585,7 +585,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(ErrorMailet.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -595,7 +595,7 @@ public class MailetErrorsTest {
     }
     
     @Test
-    public void hasExceptionMatcherShouldNotMatchWhenMailetThrowsExceptionNotSpecified() throws Exception {
+    public void hasExceptionMatcherShouldNotMatchWhenMailetThrowsExceptionNotSpecified(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_ONLY_MODULE)
             .withMailetContainer(MailetContainer.builder()
@@ -615,7 +615,7 @@ public class MailetErrorsTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(RuntimeExceptionMailet.class))))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java
index e808404..c42e2ef 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/NetworkMatcherIntegrationTest.java
@@ -25,6 +25,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
@@ -42,31 +44,29 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.MailRepositoryProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class NetworkMatcherIntegrationTest {
     private static final String FROM = "fromuser@" + DEFAULT_DOMAIN;
     private static final MailRepositoryUrl DROPPED_MAILS = MailRepositoryUrl.from("memory://var/mail/dropped-mails/");
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    private TemporaryJamesServer createJamesServerWithRootProcessor(ProcessorConfiguration.Builder rootProcessor) throws Exception {
+    private TemporaryJamesServer createJamesServerWithRootProcessor(File temporaryFolder, ProcessorConfiguration.Builder rootProcessor) throws Exception {
         TemporaryJamesServer temporaryJamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withMailetContainer(TemporaryJamesServer.defaultMailetContainerConfiguration()
                 .putProcessor(rootProcessor)
                 .putProcessor(CommonProcessors.deliverOnlyTransport()))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         temporaryJamesServer.start();
 
         DataProbe dataProbe = temporaryJamesServer.getProbe(DataProbeImpl.class);
@@ -82,14 +82,14 @@ public class NetworkMatcherIntegrationTest {
             .addProperty("repositoryPath", DROPPED_MAILS.asString());
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
 
     @Test
-    public void mailsFromAuthorizedNetworksShouldBeDeliveredWithRemoteAddrInNetwork() throws Exception {
-        jamesServer = createJamesServerWithRootProcessor(ProcessorConfiguration.root()
+    public void mailsFromAuthorizedNetworksShouldBeDeliveredWithRemoteAddrInNetwork(@TempDir File temporaryFolder) throws Exception {
+        jamesServer = createJamesServerWithRootProcessor(temporaryFolder, ProcessorConfiguration.root()
             .addMailet(MailetConfiguration.builder()
                 .matcher(RemoteAddrInNetwork.class)
                 .matcherCondition("127.0.0.0/8")
@@ -108,8 +108,8 @@ public class NetworkMatcherIntegrationTest {
     }
 
     @Test
-    public void mailsFromAuthorizedNetworksShouldBeDeliveredWithRemoteAddrNotInNetwork() throws Exception {
-        jamesServer = createJamesServerWithRootProcessor(ProcessorConfiguration.root()
+    public void mailsFromAuthorizedNetworksShouldBeDeliveredWithRemoteAddrNotInNetwork(@TempDir File temporaryFolder) throws Exception {
+        jamesServer = createJamesServerWithRootProcessor(temporaryFolder, ProcessorConfiguration.root()
             .addMailet(MailetConfiguration.builder()
                 .matcher(RemoteAddrNotInNetwork.class)
                 .matcherCondition("172.0.0.0/8")
@@ -128,8 +128,8 @@ public class NetworkMatcherIntegrationTest {
     }
 
     @Test
-    public void remoteAddrInNetworkShouldSupportLargerMask() throws Exception {
-        jamesServer = createJamesServerWithRootProcessor(ProcessorConfiguration.root()
+    public void remoteAddrInNetworkShouldSupportLargerMask(@TempDir File temporaryFolder) throws Exception {
+        jamesServer = createJamesServerWithRootProcessor(temporaryFolder, ProcessorConfiguration.root()
             .addMailet(MailetConfiguration.builder()
                 .matcher(RemoteAddrInNetwork.class)
                 .matcherCondition("127.0.0.0/2")
@@ -148,8 +148,8 @@ public class NetworkMatcherIntegrationTest {
     }
 
     @Test
-    public void remoteAddrInNetworkShouldSupportRangesDefinedByAMiddleIp() throws Exception {
-        jamesServer = createJamesServerWithRootProcessor(ProcessorConfiguration.root()
+    public void remoteAddrInNetworkShouldSupportRangesDefinedByAMiddleIp(@TempDir File temporaryFolder) throws Exception {
+        jamesServer = createJamesServerWithRootProcessor(temporaryFolder, ProcessorConfiguration.root()
             .addMailet(MailetConfiguration.builder()
                 .matcher(RemoteAddrInNetwork.class)
                 .matcherCondition("127.0.4.108/8")
@@ -168,8 +168,8 @@ public class NetworkMatcherIntegrationTest {
     }
 
     @Test
-    public void remoteAddrInNetworkShouldSupportRangesDefinedByEndingIp() throws Exception {
-        jamesServer = createJamesServerWithRootProcessor(ProcessorConfiguration.root()
+    public void remoteAddrInNetworkShouldSupportRangesDefinedByEndingIp(@TempDir File temporaryFolder) throws Exception {
+        jamesServer = createJamesServerWithRootProcessor(temporaryFolder, ProcessorConfiguration.root()
             .addMailet(MailetConfiguration.builder()
                 .matcher(RemoteAddrInNetwork.class)
                 .matcherCondition("127.255.255.255/8")
@@ -188,8 +188,8 @@ public class NetworkMatcherIntegrationTest {
     }
 
     @Test
-    public void remoteAddrInNetworkShouldSupportRangesWithNonEightMultipleSubMasks() throws Exception {
-        jamesServer = createJamesServerWithRootProcessor(ProcessorConfiguration.root()
+    public void remoteAddrInNetworkShouldSupportRangesWithNonEightMultipleSubMasks(@TempDir File temporaryFolder) throws Exception {
+        jamesServer = createJamesServerWithRootProcessor(temporaryFolder, ProcessorConfiguration.root()
             .addMailet(MailetConfiguration.builder()
                 .matcher(RemoteAddrInNetwork.class)
                 .matcherCondition("126.0.0.0/4")
@@ -208,8 +208,8 @@ public class NetworkMatcherIntegrationTest {
     }
 
     @Test
-    public void mailsFromNonAuthorizedNetworksShouldNotBeDeliveredWithRemoteAddrInNetwork() throws Exception {
-        jamesServer = createJamesServerWithRootProcessor(ProcessorConfiguration.root()
+    public void mailsFromNonAuthorizedNetworksShouldNotBeDeliveredWithRemoteAddrInNetwork(@TempDir File temporaryFolder) throws Exception {
+        jamesServer = createJamesServerWithRootProcessor(temporaryFolder, ProcessorConfiguration.root()
             .addMailet(MailetConfiguration.builder()
                 .matcher(RemoteAddrInNetwork.class)
                 .matcherCondition("172.0.0.0/8")
@@ -232,8 +232,8 @@ public class NetworkMatcherIntegrationTest {
     }
 
     @Test
-    public void mailsFromNonAuthorizedNetworksShouldNotBeDeliveredWithRemoteAddrNotInNetwork() throws Exception {
-        jamesServer = createJamesServerWithRootProcessor(ProcessorConfiguration.root()
+    public void mailsFromNonAuthorizedNetworksShouldNotBeDeliveredWithRemoteAddrNotInNetwork(@TempDir File temporaryFolder) throws Exception {
+        jamesServer = createJamesServerWithRootProcessor(temporaryFolder, ProcessorConfiguration.root()
             .addMailet(MailetConfiguration.builder()
                 .matcher(RemoteAddrNotInNetwork.class)
                 .matcherCondition("127.0.0.0/8")
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RecipientRewriteTableIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RecipientRewriteTableIntegrationTest.java
index 2546309..b0453e1 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RecipientRewriteTableIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RecipientRewriteTableIntegrationTest.java
@@ -25,6 +25,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import org.apache.james.modules.MailboxProbeImpl;
 import org.apache.james.modules.protocols.ImapGuiceProbe;
 import org.apache.james.modules.protocols.SmtpGuiceProbe;
@@ -35,11 +37,11 @@ import org.apache.james.utils.TestIMAPClient;
 import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.apache.james.webadmin.routes.ForwardRoutes;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import io.restassured.specification.RequestSpecification;
 
@@ -57,20 +59,18 @@ public class RecipientRewriteTableIntegrationTest {
     private static final String GROUP_LOCAL_PART = "group";
     private static final String GROUP = GROUP_LOCAL_PART + "@" + DEFAULT_DOMAIN;
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
     private DataProbe dataProbe;
     private RequestSpecification webAdminApi;
 
-    @Before
-    public void setup() throws Exception {
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder.newFolder());
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
+        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -84,7 +84,7 @@ public class RecipientRewriteTableIntegrationTest {
         webAdminApi = WebAdminUtils.spec(jamesServer.getProbe(WebAdminGuiceProbe.class).getWebAdminPort());
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RemoteDeliveryErrorTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RemoteDeliveryErrorTest.java
index 2923665..1b40895 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RemoteDeliveryErrorTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/RemoteDeliveryErrorTest.java
@@ -31,6 +31,7 @@ import static org.apache.james.mock.smtp.server.ConfigurationClient.BehaviorsPar
 import static org.apache.james.util.docker.Images.MOCK_SMTP_SERVER;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
 import java.net.InetAddress;
 
 import javax.mail.internet.AddressException;
@@ -56,13 +57,12 @@ import org.apache.james.util.docker.DockerContainer;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -102,22 +102,20 @@ public class RemoteDeliveryErrorTest {
     private ConfigurationClient mockSMTP1Configuration;
     private ConfigurationClient mockSMTP2Configuration;
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
-    @ClassRule
+    @RegisterExtension
     public static DockerContainer mockSmtp = DockerContainer.fromName(MOCK_SMTP_SERVER)
         .withLogConsumer(outputFrame -> LOGGER.debug("MockSMTP 1: " + outputFrame.getUtf8String()));
-    @ClassRule
+    @RegisterExtension
     public static DockerContainer mockSmtp2 = DockerContainer.fromName(MOCK_SMTP_SERVER)
         .withLogConsumer(outputFrame -> LOGGER.debug("MockSMTP 2: " + outputFrame.getUtf8String()));
 
     private TemporaryJamesServer jamesServer;
 
-    @BeforeClass
+    @BeforeAll
     public static void setUpClass() throws AddressException {
         FROM_ADDRESS = new MailAddress(FROM);
         RECIPIENT_ADDRESS = new MailAddress(RECIPIENT);
@@ -129,8 +127,8 @@ public class RemoteDeliveryErrorTest {
         FROM_RECIPIENT2_ENVELOPE = Mail.Envelope.ofAddresses(FROM_ADDRESS, RECIPIENT2_ADDRESS);
     }
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    public void setUp(@TempDir File temporaryFolder) throws Exception {
         inMemoryDNSService = new InMemoryDNSService()
             .registerMxRecord(DEFAULT_DOMAIN, LOCALHOST_IP)
             .registerMxRecord(ANOTHER_DOMAIN, mockSmtp.getContainerIp());
@@ -143,7 +141,7 @@ public class RemoteDeliveryErrorTest {
                 .putProcessor(CommonProcessors.error())
                 .putProcessor(directResolutionTransport())
                 .putProcessor(CommonProcessors.bounces()))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         jamesServer.getProbe(DataProbeImpl.class)
@@ -158,7 +156,7 @@ public class RemoteDeliveryErrorTest {
         assertThat(mockSMTP2Configuration.version()).isEqualTo("0.2");
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
 
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SenderIsLocalIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SenderIsLocalIntegrationTest.java
index 8230865..ab96740 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SenderIsLocalIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SenderIsLocalIntegrationTest.java
@@ -26,6 +26,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.RECIPIENT;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 
+import java.io.File;
+
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
@@ -43,11 +45,11 @@ import org.apache.james.utils.TestIMAPClient;
 import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.apache.james.webadmin.routes.AliasRoutes;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import io.restassured.specification.RequestSpecification;
 
@@ -56,25 +58,23 @@ public class SenderIsLocalIntegrationTest {
     private static final MailRepositoryUrl LOCAL_SENDER_REPOSITORY = MailRepositoryUrl.from("memory://var/mail/local/sender/");
     private static final MailRepositoryUrl REMOTE_SENDER_REPOSITORY = MailRepositoryUrl.from("memory://var/mail/remote/sender/");
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
     private MailRepositoryProbeImpl probe;
     private RequestSpecification webAdminApi;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    public void setUp(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.IN_MEMORY_SERVER_AGGREGATE_MODULE)
             .withMailetContainer(TemporaryJamesServer.defaultMailetContainerConfiguration()
                 .postmaster(POSTMASTER)
                 .putProcessor(transport()))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
         probe = jamesServer.getProbe(MailRepositoryProbeImpl.class);
 
@@ -84,7 +84,7 @@ public class SenderIsLocalIntegrationTest {
         webAdminApi = WebAdminUtils.spec(jamesServer.getProbe(WebAdminGuiceProbe.class).getWebAdminPort());
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SieveDelivery.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SieveDelivery.java
index 3406c55..85cabbe 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SieveDelivery.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SieveDelivery.java
@@ -26,6 +26,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.RECIPIENT;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 
+import java.io.File;
+
 import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.modules.MailboxProbeImpl;
 import org.apache.james.modules.protocols.ImapGuiceProbe;
@@ -35,27 +37,25 @@ import org.apache.james.probe.DataProbe;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class SieveDelivery {
     private static final String TARGETED_MAILBOX = "INBOX.any";
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    @Before
-    public void setup() throws Exception {
-        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder.newFolder());
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
+        jamesServer = TemporaryJamesServer.builder().build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -66,7 +66,7 @@ public class SieveDelivery {
             .createMailbox(MailboxConstants.USER_NAMESPACE, RECIPIENT, TARGETED_MAILBOX);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SizeGreaterThanIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SizeGreaterThanIntegrationTest.java
index 184b02b..62af8f8 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SizeGreaterThanIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SizeGreaterThanIntegrationTest.java
@@ -26,6 +26,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.RECIPIENT;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 
+import java.io.File;
+
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
@@ -39,32 +41,30 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.MailRepositoryProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class SizeGreaterThanIntegrationTest {
     public static final String POSTMASTER = "postmaster@" + DEFAULT_DOMAIN;
     public static final String SENDER = "sender@" + DEFAULT_DOMAIN;
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withMailetContainer(
                 generateMailetContainerConfiguration())
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         jamesServer.getProbe(DataProbeImpl.class)
@@ -74,7 +74,7 @@ public class SizeGreaterThanIntegrationTest {
             .addUser(SENDER, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java
index dc9a41d..d6a877b 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SmtpAuthIntegrationTest.java
@@ -25,6 +25,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
@@ -42,28 +44,26 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.MailRepositoryProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class SmtpAuthIntegrationTest {
     private static final String FROM = "fromuser@" + DEFAULT_DOMAIN;
     private static final MailRepositoryUrl DROPPED_MAILS = MailRepositoryUrl.from("memory://var/mail/dropped-mails/");
 
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
     private MailRepositoryProbeImpl repositoryProbe;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         ProcessorConfiguration.Builder rootProcessor = ProcessorConfiguration.root()
             .addMailet(MailetConfiguration.builder()
                 .matcher(SMTPAuthSuccessful.class)
@@ -79,7 +79,7 @@ public class SmtpAuthIntegrationTest {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -96,7 +96,7 @@ public class SmtpAuthIntegrationTest {
                 .addProperty("repositoryPath", DROPPED_MAILS.asString()));
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetConfigurationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetConfigurationTest.java
index 3144adf..36434a6 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetConfigurationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/MailetConfigurationTest.java
@@ -19,32 +19,27 @@
 package org.apache.james.mailets.configuration;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.james.transport.mailets.ToProcessor;
 import org.apache.james.transport.matchers.All;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 public class MailetConfigurationTest {
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     @Test
     public void builderShouldThrowWhenMatcherIsNull() {
-        expectedException.expect(IllegalStateException.class);
-        MailetConfiguration.builder()
-            .mailet(ToProcessor.class)
-            .build();
+        assertThatThrownBy(() -> MailetConfiguration.builder()
+                .mailet(ToProcessor.class)
+                .build())
+            .isInstanceOf(IllegalStateException.class);
     }
 
     @Test
     public void builderShouldThrowWhenMailetIsNull() {
-        expectedException.expect(IllegalStateException.class);
-        MailetConfiguration.builder()
+        assertThatThrownBy(() -> MailetConfiguration.builder()
             .matcher(All.class)
-            .build();
+            .build())
+            .isInstanceOf(IllegalStateException.class);
     }
 
     @Test
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/SmtpConfigurationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/SmtpConfigurationTest.java
index abd0c3f..2bb3b0a 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/SmtpConfigurationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/configuration/SmtpConfigurationTest.java
@@ -28,7 +28,7 @@ import java.io.IOException;
 import javax.xml.transform.Source;
 
 import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.w3c.dom.Node;
 import org.xmlunit.builder.Input;
 import org.xmlunit.xpath.JAXPXPathEngine;
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
index e8fa1fe..c415c25 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMEDecryptIntegrationTest.java
@@ -42,29 +42,27 @@ import org.apache.james.util.date.ZonedDateTimeProvider;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class SMIMEDecryptIntegrationTest {
     private static final ZonedDateTime DATE_2015 = ZonedDateTime.parse("2015-10-15T14:10:00Z");
     private static final String FROM = "sender@" + DEFAULT_DOMAIN;
     private static final String PASSWORD = "secret";
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    @Before
-    public void setup() throws Exception {
-        File workingDir = temporaryFolder.newFolder();
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         MailetContainer mailetContainer = MailetContainer.builder()
             .putProcessor(CommonProcessors.root())
             .putProcessor(CommonProcessors.error())
@@ -73,7 +71,7 @@ public class SMIMEDecryptIntegrationTest {
                 .addMailet(MailetConfiguration.builder()
                     .mailet(SMIMEDecrypt.class)
                     .matcher(All.class)
-                    .addProperty("keyStoreFileName", workingDir.toPath().resolve("conf").resolve("smime.p12").toAbsolutePath().toString())
+                    .addProperty("keyStoreFileName", temporaryFolder.toPath().resolve("conf").resolve("smime.p12").toAbsolutePath().toString())
                     .addProperty("keyStorePassword", "secret")
                     .addProperty("keyStoreType", "PKCS12")
                     .addProperty("debug", "true"))
@@ -84,7 +82,7 @@ public class SMIMEDecryptIntegrationTest {
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withOverrides(binder -> binder.bind(ZonedDateTimeProvider.class).toInstance(() -> DATE_2015))
             .withMailetContainer(mailetContainer)
-            .build(workingDir);
+            .build(temporaryFolder);
         jamesServer.start();
 
         jamesServer.getProbe(DataProbeImpl.class)
@@ -93,7 +91,7 @@ public class SMIMEDecryptIntegrationTest {
             .addUser(FROM, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java
index 90c9709..8feee6e 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/crypto/SMIMESignIntegrationTest.java
@@ -45,30 +45,27 @@ import org.apache.james.util.date.ZonedDateTimeProvider;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class SMIMESignIntegrationTest {
 
     private static final ZonedDateTime DATE_2015 = ZonedDateTime.parse("2015-10-15T14:10:00Z");
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
     public static final String FROM = "user@" + DEFAULT_DOMAIN;
     public static final String RECIPIENT = "user2@" + DEFAULT_DOMAIN;
 
-    @Before
-    public void setup() throws Exception {
-        File workingDir = temporaryFolder.newFolder();
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         MailetContainer mailetContainer = MailetContainer.builder()
             .putProcessor(CommonProcessors.root())
             .putProcessor(CommonProcessors.error())
@@ -83,7 +80,7 @@ public class SMIMESignIntegrationTest {
                 .addMailet(MailetConfiguration.builder()
                     .mailet(SMIMESign.class)
                     .matcher(SenderIsLocal.class)
-                    .addProperty("keyStoreFileName", workingDir.toPath().resolve("conf").resolve("smime.p12").toAbsolutePath().toString())
+                    .addProperty("keyStoreFileName", temporaryFolder.toPath().resolve("conf").resolve("smime.p12").toAbsolutePath().toString())
                     .addProperty("keyStorePassword", "secret")
                     .addProperty("keyStoreType", "PKCS12")
                     .addProperty("debug", "true"))
@@ -94,7 +91,7 @@ public class SMIMESignIntegrationTest {
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withOverrides(binder -> binder.bind(ZonedDateTimeProvider.class).toInstance(() -> DATE_2015))
             .withMailetContainer(mailetContainer)
-            .build(workingDir);
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -103,7 +100,7 @@ public class SMIMESignIntegrationTest {
         dataProbe.addUser(RECIPIENT, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/DSNRelayTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/DSNRelayTest.java
index 3a1b00d..2e49c37 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/DSNRelayTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/DSNRelayTest.java
@@ -28,8 +28,9 @@ import static org.apache.james.util.docker.Images.MOCK_SMTP_SERVER;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.awaitility.Duration.TEN_SECONDS;
 
+import java.io.File;
+
 import org.apache.commons.net.smtp.AuthenticatingSMTPClient;
-import org.apache.james.core.Domain;
 import org.apache.james.core.MailAddress;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.InMemoryDNSService;
@@ -56,13 +57,12 @@ import org.apache.james.util.docker.DockerContainer;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -78,20 +78,18 @@ public class DSNRelayTest {
     private InMemoryDNSService inMemoryDNSService;
     private ConfigurationClient mockSMTPConfiguration;
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
-    @ClassRule
+    @RegisterExtension
     public static DockerContainer mockSmtp = DockerContainer.fromName(MOCK_SMTP_SERVER)
         .withLogConsumer(outputFrame -> LOGGER.debug("MockSMTP 1: " + outputFrame.getUtf8String()));
 
     private TemporaryJamesServer jamesServer;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    public void setUp(@TempDir File temporaryFolder) throws Exception {
         inMemoryDNSService = new InMemoryDNSService()
             .registerMxRecord(DEFAULT_DOMAIN, LOCALHOST_IP)
             .registerMxRecord(ANOTHER_DOMAIN, mockSmtp.getContainerIp());
@@ -109,7 +107,7 @@ public class DSNRelayTest {
                 .addHook(DSNMailParameterHook.class.getName())
                 .addHook(DSNRcptParameterHook.class.getName())
                 .addHook(DSNMessageHook.class.getName()))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         jamesServer.getProbe(DataProbeImpl.class)
@@ -123,14 +121,14 @@ public class DSNRelayTest {
         assertThat(mockSMTPConfiguration.version()).isEqualTo("0.2");
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
 
         mockSMTPConfiguration.cleanServer();
     }
 
-    @Ignore("JAMES-3431 No javax.mail support for ORCPT DSN parameter...")
+    @Disabled("JAMES-3431 No javax.mail support for ORCPT DSN parameter...")
     @Test
     public void orcptIsUnsupported() throws Exception {
         AuthenticatingSMTPClient smtpClient = new AuthenticatingSMTPClient("TLS", "UTF-8");
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
index e74ca1e..256bead 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpAuthorizedAddressesTest.java
@@ -27,6 +27,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.hasSize;
 
+import java.io.File;
+
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.CommonProcessors;
@@ -44,28 +46,25 @@ import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.SMTPSendingException;
 import org.apache.james.utils.SmtpSendingStep;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class SmtpAuthorizedAddressesTest {
     private static final String FROM = "fromuser@" + DEFAULT_DOMAIN;
     private static final String TO = "to@any.com";
 
-    @ClassRule
+    @RegisterExtension
     public static FakeSmtp fakeSmtp = FakeSmtp.withDefaultPort();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
     private TemporaryJamesServer jamesServer;
 
-    private void createJamesServer(SmtpConfiguration.Builder smtpConfiguration) throws Exception {
+    private void createJamesServer(File temporaryFolder, SmtpConfiguration.Builder smtpConfiguration) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.transport()
                 .addMailetsFrom(CommonProcessors.deliverOnlyTransport())
@@ -78,7 +77,7 @@ public class SmtpAuthorizedAddressesTest {
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withSmtpConfiguration(smtpConfiguration)
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -86,7 +85,7 @@ public class SmtpAuthorizedAddressesTest {
         dataProbe.addUser(FROM, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         fakeSmtp.clean();
         if (jamesServer != null) {
@@ -95,8 +94,8 @@ public class SmtpAuthorizedAddressesTest {
     }
 
     @Test
-    public void userShouldBeAbleToRelayMessagesWhenInAcceptedNetwork() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void userShouldBeAbleToRelayMessagesWhenInAcceptedNetwork(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .requireAuthentication()
             .withAutorizedAddresses("127.0.0.0/8"));
 
@@ -111,8 +110,8 @@ public class SmtpAuthorizedAddressesTest {
     }
 
     @Test
-    public void userShouldNotBeAbleToRelayMessagesWhenOutOfAcceptedNetwork() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void userShouldNotBeAbleToRelayMessagesWhenOutOfAcceptedNetwork(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .requireAuthentication()
             .withAutorizedAddresses("172.0.0.0/8"));
 
@@ -123,8 +122,8 @@ public class SmtpAuthorizedAddressesTest {
     }
 
     @Test
-    public void userShouldBeAbleToRelayMessagesWhenOutOfAcceptedNetworkButAuthenticated() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void userShouldBeAbleToRelayMessagesWhenOutOfAcceptedNetworkButAuthenticated(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .requireAuthentication()
             .withAutorizedAddresses("172.0.0.0/8"));
 
@@ -140,8 +139,8 @@ public class SmtpAuthorizedAddressesTest {
     }
 
     @Test
-    public void localDeliveryShouldBePossibleFromNonAuthenticatedNonAuthorizedSender() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void localDeliveryShouldBePossibleFromNonAuthenticatedNonAuthorizedSender(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .requireAuthentication()
             .withAutorizedAddresses("172.0.0.0/8"));
 
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpBracketEnforcementTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpBracketEnforcementTest.java
index 742af1c..f95cfa3 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpBracketEnforcementTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpBracketEnforcementTest.java
@@ -24,6 +24,8 @@ import static org.apache.james.mailets.configuration.Constants.LOCALHOST_IP;
 import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import java.io.File;
+
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.SmtpConfiguration;
 import org.apache.james.modules.protocols.SmtpGuiceProbe;
@@ -32,25 +34,23 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.SMTPSendingException;
 import org.apache.james.utils.SmtpSendingStep;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class SmtpBracketEnforcementTest {
     private static final String USER = "user@" + DEFAULT_DOMAIN;
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    private void createJamesServer(SmtpConfiguration.Builder smtpConfiguration) throws Exception {
+    private void createJamesServer(File temporaryFolder, SmtpConfiguration.Builder smtpConfiguration) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withSmtpConfiguration(smtpConfiguration)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -58,7 +58,7 @@ public class SmtpBracketEnforcementTest {
         dataProbe.addUser(USER, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         if (jamesServer != null) {
             jamesServer.shutdown();
@@ -66,8 +66,8 @@ public class SmtpBracketEnforcementTest {
     }
 
     @Test
-    public void recipientWithBracketsShouldBeAcceptedWhenNoBracketRequired() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void recipientWithBracketsShouldBeAcceptedWhenNoBracketRequired(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .doNotRequireBracketEnforcement());
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
@@ -76,8 +76,8 @@ public class SmtpBracketEnforcementTest {
     }
 
     @Test
-    public void recipientWithNoBracketsShouldBeAcceptedWhenNoBracketRequired() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void recipientWithNoBracketsShouldBeAcceptedWhenNoBracketRequired(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .doNotRequireBracketEnforcement());
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
@@ -86,8 +86,8 @@ public class SmtpBracketEnforcementTest {
     }
 
     @Test
-    public void recipientWithBracketsShouldBeAcceptedWhenBracketRequired() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void recipientWithBracketsShouldBeAcceptedWhenBracketRequired(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .requireBracketEnforcement());
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
@@ -96,8 +96,8 @@ public class SmtpBracketEnforcementTest {
     }
 
     @Test
-    public void recipientWithNoBracketsShouldBeRejectedWhenBracketRequired() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void recipientWithNoBracketsShouldBeRejectedWhenBracketRequired(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .requireBracketEnforcement());
 
         assertThatThrownBy(() ->
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpContentTypeTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpContentTypeTest.java
index 6e75bd1..e6b8898 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpContentTypeTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpContentTypeTest.java
@@ -28,6 +28,8 @@ import static org.hamcrest.Matchers.hasSize;
 import static org.hamcrest.Matchers.not;
 import static org.hamcrest.Matchers.startsWith;
 
+import java.io.File;
+
 import javax.mail.MessagingException;
 
 import org.apache.james.MemoryJamesServerMain;
@@ -47,29 +49,26 @@ import org.apache.james.utils.FakeSmtp;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
 import org.apache.mailet.Mail;
-import org.junit.After;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class SmtpContentTypeTest {
     private static final String FROM = "fromuser@" + DEFAULT_DOMAIN;
     private static final String TO = "to@any.com";
     public static final String SUBJECT = "test";
 
-    @ClassRule
+    @RegisterExtension
     public static FakeSmtp fakeSmtp = FakeSmtp.withDefaultPort();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
     private TemporaryJamesServer jamesServer;
 
-    private void createJamesServer(SmtpConfiguration.Builder smtpConfiguration) throws Exception {
+    private void createJamesServer(File temporaryFolder, SmtpConfiguration.Builder smtpConfiguration) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.transport()
                 .addMailetsFrom(CommonProcessors.deliverOnlyTransport())
@@ -82,7 +81,7 @@ public class SmtpContentTypeTest {
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withSmtpConfiguration(smtpConfiguration)
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -90,7 +89,7 @@ public class SmtpContentTypeTest {
         dataProbe.addUser(FROM, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         fakeSmtp.clean();
         if (jamesServer != null) {
@@ -99,8 +98,8 @@ public class SmtpContentTypeTest {
     }
 
     @Test
-    public void userShouldBeAbleToReceiveMessagesWithGoodContentType() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void userShouldBeAbleToReceiveMessagesWithGoodContentType(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .requireAuthentication()
             .withAutorizedAddresses("172.0.0.0/8"));
 
@@ -117,8 +116,8 @@ public class SmtpContentTypeTest {
     }
 
     @Test
-    public void userShouldBeAbleToReceiveMessagesWithBadContentType() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void userShouldBeAbleToReceiveMessagesWithBadContentType(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .requireAuthentication()
             .withAutorizedAddresses("172.0.0.0/8"));
 
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpIdentityVerificationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpIdentityVerificationTest.java
index c448373..cb9173b 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpIdentityVerificationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpIdentityVerificationTest.java
@@ -24,6 +24,8 @@ import static org.apache.james.mailets.configuration.Constants.LOCALHOST_IP;
 import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import java.io.File;
+
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.SmtpConfiguration;
 import org.apache.james.modules.protocols.SmtpGuiceProbe;
@@ -32,10 +34,10 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.SMTPSendingException;
 import org.apache.james.utils.SmtpSendingStep;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class SmtpIdentityVerificationTest {
     private static final String ATTACKER_PASSWORD = "secret";
@@ -43,17 +45,15 @@ public class SmtpIdentityVerificationTest {
     private static final String ATTACKER = "attacker@" + DEFAULT_DOMAIN;
     private static final String USER = "user@" + DEFAULT_DOMAIN;
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    private void createJamesServer(SmtpConfiguration.Builder smtpConfiguration) throws Exception {
+    private void createJamesServer(File temporaryFolder, SmtpConfiguration.Builder smtpConfiguration) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withSmtpConfiguration(smtpConfiguration)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -62,7 +62,7 @@ public class SmtpIdentityVerificationTest {
         dataProbe.addUser(ATTACKER, ATTACKER_PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         if (jamesServer != null) {
             jamesServer.shutdown();
@@ -70,8 +70,8 @@ public class SmtpIdentityVerificationTest {
     }
 
     @Test
-    public void smtpShouldAcceptMessageWhenIdentityIsMatching() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void smtpShouldAcceptMessageWhenIdentityIsMatching(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .requireAuthentication()
             .verifyIdentity());
 
@@ -80,8 +80,8 @@ public class SmtpIdentityVerificationTest {
     }
 
     @Test
-    public void smtpShouldAcceptMessageWhenIdentityIsNotMatchingButNotChecked() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void smtpShouldAcceptMessageWhenIdentityIsNotMatchingButNotChecked(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .requireAuthentication()
             .doNotVerifyIdentity());
 
@@ -91,8 +91,8 @@ public class SmtpIdentityVerificationTest {
     }
 
     @Test
-    public void smtpShouldRejectMessageWhenIdentityIsNotMatching() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void smtpShouldRejectMessageWhenIdentityIsNotMatching(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .requireAuthentication()
             .verifyIdentity());
 
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpNullSenderTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpNullSenderTest.java
index 34618ac..5099f2c 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpNullSenderTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpNullSenderTest.java
@@ -24,6 +24,8 @@ import static org.apache.james.mailets.configuration.Constants.LOCALHOST_IP;
 import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 
+import java.io.File;
+
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.modules.protocols.ImapGuiceProbe;
 import org.apache.james.modules.protocols.SmtpGuiceProbe;
@@ -31,28 +33,26 @@ import org.apache.james.probe.DataProbe;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class SmtpNullSenderTest {
     private static final String USER = "user@" + DEFAULT_DOMAIN;
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
 
     private TemporaryJamesServer jamesServer;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    public void setUp(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -60,7 +60,7 @@ public class SmtpNullSenderTest {
         dataProbe.addUser(USER, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java
index ef7b734..753bbef 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java
@@ -25,6 +25,7 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.calmlyAwait;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.Collection;
 import java.util.stream.IntStream;
@@ -55,11 +56,11 @@ import org.apache.james.utils.TestIMAPClient;
 import org.apache.mailet.Mail;
 import org.awaitility.Duration;
 import org.awaitility.core.ConditionFactory;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import com.github.fge.lambdas.Throwing;
 import com.github.steveash.guavate.Guavate;
@@ -84,18 +85,16 @@ public class SmtpRandomStoringTest {
             .mailet(RandomStoring.class)
             .build();
 
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
     private TemporaryJamesServer jamesServer;
     private ImapGuiceProbe imapProbe;
     private Collection<TestIMAPClient> connections;
 
-    @Before
-    public void setUp() throws Exception {
-        createJamesServer();
+    @BeforeEach
+    public void setUp(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder);
 
         createUsersAndMailboxes();
 
@@ -130,7 +129,7 @@ public class SmtpRandomStoringTest {
         }
     }
 
-    private void createJamesServer() throws Exception {
+    private void createJamesServer(File temporaryFolder) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.transport()
                 .addMailet(RANDOM_STORING)
@@ -139,7 +138,7 @@ public class SmtpRandomStoringTest {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
     }
 
@@ -155,7 +154,7 @@ public class SmtpRandomStoringTest {
         }
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         connections.forEach(Throwing.consumer(TestIMAPClient::close).sneakyThrow());
         jamesServer.shutdown();
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpSizeLimitationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpSizeLimitationTest.java
index 906d102..a41c288 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpSizeLimitationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpSizeLimitationTest.java
@@ -24,6 +24,8 @@ import static org.apache.james.mailets.configuration.Constants.LOCALHOST_IP;
 import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import java.io.File;
+
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.SmtpConfiguration;
 import org.apache.james.modules.protocols.SmtpGuiceProbe;
@@ -32,27 +34,25 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.SMTPSendingException;
 import org.apache.james.utils.SmtpSendingStep;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import com.google.common.base.Strings;
 
 public class SmtpSizeLimitationTest {
     private static final String USER = "user@" + DEFAULT_DOMAIN;
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    private void createJamesServer(SmtpConfiguration.Builder smtpConfiguration) throws Exception {
+    private void createJamesServer(File temporaryFolder, SmtpConfiguration.Builder smtpConfiguration) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withSmtpConfiguration(smtpConfiguration)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -60,7 +60,7 @@ public class SmtpSizeLimitationTest {
         dataProbe.addUser(USER, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         if (jamesServer != null) {
             jamesServer.shutdown();
@@ -68,8 +68,8 @@ public class SmtpSizeLimitationTest {
     }
 
     @Test
-    public void messageShouldNotBeAcceptedWhenOverSized() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void messageShouldNotBeAcceptedWhenOverSized(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .doNotVerifyIdentity()
             .withMaxMessageSizeInKb(10));
 
@@ -81,8 +81,8 @@ public class SmtpSizeLimitationTest {
     }
 
     @Test
-    public void messageShouldBeAcceptedWhenNotOverSized() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void messageShouldBeAcceptedWhenNotOverSized(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .doNotVerifyIdentity()
             .withMaxMessageSizeInKb(10));
 
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/extensions/SMTPHeloHooksTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/extensions/SMTPHeloHooksTest.java
index 753475f..7dde9e9 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/extensions/SMTPHeloHooksTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/extensions/SMTPHeloHooksTest.java
@@ -26,6 +26,8 @@ import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMin
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import java.io.File;
+
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.mailets.TemporaryJamesServer;
@@ -44,27 +46,25 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.SMTPSendingException;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class SMTPHeloHooksTest {
     private static final String FROM = "fromuser@" + DEFAULT_DOMAIN;
     private static final String TO = "to@" + DEFAULT_DOMAIN;
 
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public StaticInputChecker resultChecker = new StaticInputChecker();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
 
     private TemporaryJamesServer jamesServer;
 
-    private void createJamesServer(SmtpConfiguration.Builder smtpConfiguration) throws Exception {
+    private void createJamesServer(File temporaryFolder, SmtpConfiguration.Builder smtpConfiguration) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(CommonProcessors.deliverOnlyTransport());
 
@@ -72,7 +72,7 @@ public class SMTPHeloHooksTest {
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withSmtpConfiguration(smtpConfiguration)
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -81,7 +81,7 @@ public class SMTPHeloHooksTest {
         dataProbe.addUser(TO, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         if (jamesServer != null) {
             jamesServer.shutdown();
@@ -89,8 +89,8 @@ public class SMTPHeloHooksTest {
     }
 
     @Test
-    public void heloHookShouldBeCalledWithTheRightArgument() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void heloHookShouldBeCalledWithTheRightArgument(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .addHook(RecordingHeloHook.class.getCanonicalName()));
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
@@ -102,8 +102,8 @@ public class SMTPHeloHooksTest {
     }
 
     @Test
-    public void mailShouldBeWellDeliveredUponDeclinedHeloHook() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void mailShouldBeWellDeliveredUponDeclinedHeloHook(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .addHook(DeclinedHeloHook.class.getCanonicalName()));
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
@@ -116,8 +116,8 @@ public class SMTPHeloHooksTest {
     }
 
     @Test
-    public void mailShouldBeWellDeliveredUponOKHeloHook() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void mailShouldBeWellDeliveredUponOKHeloHook(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .addHook(OkHeloHook.class.getCanonicalName()));
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
@@ -130,8 +130,8 @@ public class SMTPHeloHooksTest {
     }
 
     @Test
-    public void mailShouldBeWellDeliveredUponOKHeloHookFollowedByADenyHook() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void mailShouldBeWellDeliveredUponOKHeloHookFollowedByADenyHook(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .addHook(OkHeloHook.class.getCanonicalName())
             .addHook(DenyHeloHook.class.getCanonicalName()));
 
@@ -145,8 +145,8 @@ public class SMTPHeloHooksTest {
     }
 
     @Test
-    public void denyHeloHookShouldBeAppliedAfterADeclinedHeloHook() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void denyHeloHookShouldBeAppliedAfterADeclinedHeloHook(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .addHook(DeclinedHeloHook.class.getCanonicalName())
             .addHook(DenyHeloHook.class.getCanonicalName()));
 
@@ -158,8 +158,8 @@ public class SMTPHeloHooksTest {
     }
 
     @Test
-    public void smtpSessionShouldBeAbortedUponDenyHeloHook() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void smtpSessionShouldBeAbortedUponDenyHeloHook(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .addHook(DenyHeloHook.class.getCanonicalName()));
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort());
@@ -170,8 +170,8 @@ public class SMTPHeloHooksTest {
     }
 
     @Test
-    public void smtpSessionShouldBeAbortedUponDenySoftHeloHook() throws Exception {
-        createJamesServer(SmtpConfiguration.builder()
+    public void smtpSessionShouldBeAbortedUponDenySoftHeloHook(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, SmtpConfiguration.builder()
             .addHook(DenySoftHeloHook.class.getCanonicalName()));
 
         messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort());
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/extensions/StaticInputChecker.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/extensions/StaticInputChecker.java
index 4b57559..179af30 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/extensions/StaticInputChecker.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/extensions/StaticInputChecker.java
@@ -23,11 +23,12 @@ import java.util.ArrayList;
 
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.james.protocols.smtp.hook.Hook;
-import org.junit.rules.ExternalResource;
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
 
 import com.google.common.collect.ImmutableList;
 
-public class StaticInputChecker extends ExternalResource {
+public class StaticInputChecker implements AfterEachCallback {
     private static final ArrayList<Pair<Class<? extends Hook>, ?>> results = new ArrayList<>();
 
     public static void registerHookResult(Class<? extends Hook> clazz, Object result) {
@@ -35,7 +36,7 @@ public class StaticInputChecker extends ExternalResource {
     }
 
     @Override
-    protected void after() {
+    public void afterEach(ExtensionContext extensionContext) {
         results.clear();
     }
 
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AddFooterTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AddFooterTest.java
index 30bd565..02c8bfb 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AddFooterTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AddFooterTest.java
@@ -27,40 +27,40 @@ import static org.apache.james.mailets.configuration.Constants.RECIPIENT;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import org.apache.james.core.builder.MimeMessageBuilder;
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.CommonProcessors;
 import org.apache.james.mailets.configuration.MailetConfiguration;
 import org.apache.james.mailets.configuration.ProcessorConfiguration;
-import org.apache.james.modules.queue.activemq.ActiveMQQueueModule;
 import org.apache.james.modules.protocols.ImapGuiceProbe;
 import org.apache.james.modules.protocols.SmtpGuiceProbe;
+import org.apache.james.modules.queue.activemq.ActiveMQQueueModule;
 import org.apache.james.probe.DataProbe;
 import org.apache.james.transport.matchers.All;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class AddFooterTest {
     public static final String MATCH_ME = "Match me";
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender smtpMessageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
 
     private TemporaryJamesServer jamesServer;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withOverrides(new ActiveMQQueueModule())
             .withMailetContainer(TemporaryJamesServer.simpleMailetContainerConfiguration()
@@ -70,7 +70,7 @@ public class AddFooterTest {
                         .mailet(AddFooter.class)
                         .addProperty("text", MATCH_ME))
                     .addMailetsFrom(CommonProcessors.transport())))
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -78,7 +78,7 @@ public class AddFooterTest {
         dataProbe.addUser(RECIPIENT, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AliasMappingTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AliasMappingTest.java
index 2a5666e..7a4ba04 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AliasMappingTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AliasMappingTest.java
@@ -25,6 +25,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import javax.mail.internet.MimeMessage;
 
 import org.apache.james.core.Username;
@@ -48,11 +50,11 @@ import org.apache.james.webadmin.routes.AliasRoutes;
 import org.apache.james.webadmin.routes.ForwardRoutes;
 import org.apache.james.webadmin.routes.GroupsRoutes;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import io.restassured.specification.RequestSpecification;
 
@@ -85,22 +87,20 @@ public class AliasMappingTest {
     private DataProbe dataProbe;
     private RequestSpecification webAdminApi;
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(CommonProcessors.rrtErrorEnabledTransport())
             .putProcessor(CommonProcessors.rrtErrorProcessor());
 
         jamesServer = TemporaryJamesServer.builder()
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -123,7 +123,7 @@ public class AliasMappingTest {
             .build();
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
index a173679..d03be06 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttachmentTest.java
@@ -25,6 +25,7 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
 import java.nio.charset.StandardCharsets;
 
 import org.apache.james.MemoryJamesServerMain;
@@ -37,22 +38,17 @@ import org.apache.james.mailets.configuration.ProcessorConfiguration;
 import org.apache.james.modules.protocols.ImapGuiceProbe;
 import org.apache.james.modules.protocols.SmtpGuiceProbe;
 import org.apache.james.probe.DataProbe;
-import org.apache.james.transport.mailets.amqp.AmqpRule;
+import org.apache.james.transport.mailets.amqp.AmqpExtension;
 import org.apache.james.transport.matchers.All;
-import org.apache.james.util.docker.DockerContainer;
-import org.apache.james.util.docker.Images;
-import org.apache.james.util.docker.RateLimiters;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TemporaryFolder;
-import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class AmqpForwardAttachmentTest {
     private static final String FROM = "fromUser@" + DEFAULT_DOMAIN;
@@ -64,25 +60,17 @@ public class AmqpForwardAttachmentTest {
     
     private static final byte[] TEST_ATTACHMENT_CONTENT = "Test attachment content".getBytes(StandardCharsets.UTF_8);
 
-    public DockerContainer rabbitMqContainer = DockerContainer.fromName(Images.RABBITMQ)
-        .withAffinityToContainer()
-        .waitingFor(new HostPortWaitStrategy()
-            .withRateLimiter(RateLimiters.TWENTIES_PER_SECOND));
-
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    public AmqpRule amqpRule = new AmqpRule(rabbitMqContainer, EXCHANGE_NAME, ROUTING_KEY);
-
-    @Rule
-    public final RuleChain chain = RuleChain.outerRule(temporaryFolder).around(rabbitMqContainer).around(amqpRule);
-    @Rule
+    @RegisterExtension
+    public static AmqpExtension amqpExtension = new AmqpExtension(EXCHANGE_NAME, ROUTING_KEY);
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
     
     private TemporaryJamesServer jamesServer;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.defaultMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.transport()
                 .addMailet(MailetConfiguration.builder()
@@ -97,7 +85,7 @@ public class AmqpForwardAttachmentTest {
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
                     .mailet(AmqpForwardAttribute.class)
-                    .addProperty(AmqpForwardAttribute.URI_PARAMETER_NAME, amqpRule.getAmqpUri())
+                    .addProperty(AmqpForwardAttribute.URI_PARAMETER_NAME, amqpExtension.getAmqpUri())
                     .addProperty(AmqpForwardAttribute.EXCHANGE_PARAMETER_NAME, EXCHANGE_NAME)
                     .addProperty(AmqpForwardAttribute.ATTRIBUTE_PARAMETER_NAME, MAIL_ATTRIBUTE)
                     .addProperty(AmqpForwardAttribute.ROUTING_KEY_PARAMETER_NAME, ROUTING_KEY))
@@ -106,7 +94,7 @@ public class AmqpForwardAttachmentTest {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataprobe = jamesServer.getProbe(DataProbeImpl.class);
@@ -114,7 +102,7 @@ public class AmqpForwardAttachmentTest {
         dataprobe.addUser(RECIPIENT, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() throws Exception {
         jamesServer.shutdown();
     }
@@ -143,7 +131,7 @@ public class AmqpForwardAttachmentTest {
             .select(TestIMAPClient.INBOX)
             .awaitMessage(awaitAtMostOneMinute);
 
-        assertThat(amqpRule.readContentAsBytes()).contains(TEST_ATTACHMENT_CONTENT);
+        assertThat(amqpExtension.readContentAsBytes()).contains(TEST_ATTACHMENT_CONTENT);
     }
 
 }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
index 85cf9f3..864eb6a 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
@@ -25,6 +25,7 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
 import java.util.Optional;
 
 import org.apache.james.MemoryJamesServerMain;
@@ -36,23 +37,18 @@ import org.apache.james.mailets.configuration.MailetContainer;
 import org.apache.james.mailets.configuration.ProcessorConfiguration;
 import org.apache.james.modules.protocols.ImapGuiceProbe;
 import org.apache.james.modules.protocols.SmtpGuiceProbe;
-import org.apache.james.transport.mailets.amqp.AmqpRule;
+import org.apache.james.transport.mailets.amqp.AmqpExtension;
 import org.apache.james.transport.matchers.All;
 import org.apache.james.transport.matchers.SMTPAuthSuccessful;
-import org.apache.james.util.docker.DockerContainer;
-import org.apache.james.util.docker.Images;
-import org.apache.james.util.docker.RateLimiters;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TemporaryFolder;
-import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class ContactExtractorTest {
     public static final String SENDER = "sender@" + DEFAULT_DOMAIN;
@@ -65,22 +61,17 @@ public class ContactExtractorTest {
     public static final String EXCHANGE = "collector:email";
     public static final String ROUTING_KEY = "";
 
-    public DockerContainer rabbit = DockerContainer.fromName(Images.RABBITMQ)
-        .waitingFor(new HostPortWaitStrategy().withRateLimiter(RateLimiters.TWENTIES_PER_SECOND));
-    public AmqpRule amqpRule = new AmqpRule(rabbit, EXCHANGE, ROUTING_KEY);
-    public TemporaryFolder folder = new TemporaryFolder();
-
-    @Rule
-    public RuleChain chain = RuleChain.outerRule(rabbit).around(amqpRule).around(folder);
-    @Rule
+    @RegisterExtension
+    public static AmqpExtension amqpExtension = new AmqpExtension(EXCHANGE, ROUTING_KEY);
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         String attribute = "ExtractedContacts";
         MailetContainer.Builder mailets = TemporaryJamesServer.defaultMailetContainerConfiguration()
             .postmaster(SENDER)
@@ -93,7 +84,7 @@ public class ContactExtractorTest {
                     .addMailet(MailetConfiguration.builder()
                         .matcher(All.class)
                         .mailet(AmqpForwardAttribute.class)
-                        .addProperty(AmqpForwardAttribute.URI_PARAMETER_NAME, amqpRule.getAmqpUri())
+                        .addProperty(AmqpForwardAttribute.URI_PARAMETER_NAME, amqpExtension.getAmqpUri())
                         .addProperty(AmqpForwardAttribute.EXCHANGE_PARAMETER_NAME, EXCHANGE)
                         .addProperty(AmqpForwardAttribute.ATTRIBUTE_PARAMETER_NAME, attribute))
                     .addMailetsFrom(CommonProcessors.deliverOnlyTransport()));
@@ -101,7 +92,7 @@ public class ContactExtractorTest {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withMailetContainer(mailets)
-            .build(folder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         jamesServer.getProbe(DataProbeImpl.class)
@@ -116,7 +107,7 @@ public class ContactExtractorTest {
             .addUser(BCC2, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
@@ -143,7 +134,7 @@ public class ContactExtractorTest {
             .select(TestIMAPClient.INBOX)
             .awaitMessage(awaitAtMostOneMinute);
 
-        Optional<String> actual = amqpRule.readContent();
+        Optional<String> actual = amqpExtension.readContent();
         assertThat(actual).isNotEmpty();
         assertThatJson(actual.get()).isEqualTo("{"
             + "\"userEmail\" : \"sender@james.org\", "
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/DlpIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/DlpIntegrationTest.java
index 65a17de..f83a088 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/DlpIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/DlpIntegrationTest.java
@@ -29,6 +29,8 @@ import static org.apache.james.mailets.configuration.Constants.RECIPIENT2;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.core.builder.MimeMessageBuilder;
 import org.apache.james.mailets.TemporaryJamesServer;
@@ -47,10 +49,10 @@ import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.apache.mailet.base.test.FakeMail;
 import org.eclipse.jetty.http.HttpStatus;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import com.google.inject.util.Modules;
 
@@ -59,18 +61,15 @@ import io.restassured.specification.RequestSpecification;
 public class DlpIntegrationTest {
     public static final String REPOSITORY_PREFIX = "memory://var/mail/dlp/quarantine/";
 
-    @Rule
-    public TemporaryFolder folder = new TemporaryFolder();
-
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
     private RequestSpecification specification;
 
-    private void createJamesServer(MailetConfiguration.Builder dlpMailet) throws Exception {
+    private void createJamesServer(File folder, MailetConfiguration.Builder dlpMailet) throws Exception {
         MailetContainer.Builder mailets = TemporaryJamesServer.defaultMailetContainerConfiguration()
             .putProcessor(
                 ProcessorConfiguration.transport()
@@ -81,7 +80,7 @@ public class DlpIntegrationTest {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(Modules.combine(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE, MemoryJamesServerMain.WEBADMIN_TESTING))
             .withMailetContainer(mailets)
-            .build(folder.newFolder());
+            .build(folder);
         jamesServer.start();
 
         jamesServer.getProbe(DataProbeImpl.class)
@@ -93,14 +92,14 @@ public class DlpIntegrationTest {
         specification = WebAdminUtils.spec(jamesServer.getProbe(WebAdminGuiceProbe.class).getWebAdminPort());
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
 
     @Test
-    public void dlpShouldStoreMatchingEmails() throws Exception {
-        createJamesServer(MailetConfiguration.builder()
+    public void dlpShouldStoreMatchingEmails(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, MailetConfiguration.builder()
             .matcher(Dlp.class)
             .mailet(ToSenderDomainRepository.class)
             .addProperty(ToSenderDomainRepository.URL_PREFIX, REPOSITORY_PREFIX));
@@ -131,8 +130,8 @@ public class DlpIntegrationTest {
     }
 
     @Test
-    public void dlpShouldNotCreateRepositoryWhenNotAllowed() throws Exception {
-        createJamesServer(MailetConfiguration.builder()
+    public void dlpShouldNotCreateRepositoryWhenNotAllowed(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, MailetConfiguration.builder()
             .matcher(Dlp.class)
             .mailet(ToSenderDomainRepository.class)
             .addProperty(ToSenderDomainRepository.URL_PREFIX, REPOSITORY_PREFIX)
@@ -169,8 +168,8 @@ public class DlpIntegrationTest {
     }
 
     @Test
-    public void dlpShouldCreateRepositoryWhenAllowed() throws Exception {
-        createJamesServer(MailetConfiguration.builder()
+    public void dlpShouldCreateRepositoryWhenAllowed(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, MailetConfiguration.builder()
             .matcher(Dlp.class)
             .mailet(ToSenderDomainRepository.class)
             .addProperty(ToSenderDomainRepository.URL_PREFIX, REPOSITORY_PREFIX)
@@ -203,8 +202,8 @@ public class DlpIntegrationTest {
     }
 
     @Test
-    public void dlpShouldStoreMailWhenNotAllowedButRepositoryExists() throws Exception {
-        createJamesServer(MailetConfiguration.builder()
+    public void dlpShouldStoreMailWhenNotAllowedButRepositoryExists(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, MailetConfiguration.builder()
             .matcher(Dlp.class)
             .mailet(ToSenderDomainRepository.class)
             .addProperty(ToSenderDomainRepository.URL_PREFIX, REPOSITORY_PREFIX)
@@ -242,8 +241,8 @@ public class DlpIntegrationTest {
     }
 
     @Test
-    public void dlpShouldBeAbleToReadMailContentWithAttachments() throws Exception {
-        createJamesServer(MailetConfiguration.builder()
+    public void dlpShouldBeAbleToReadMailContentWithAttachments(@TempDir File temporaryFolder) throws Exception {
+        createJamesServer(temporaryFolder, MailetConfiguration.builder()
             .matcher(Dlp.class)
             .mailet(ToSenderDomainRepository.class)
             .addProperty(ToSenderDomainRepository.URL_PREFIX, REPOSITORY_PREFIX)
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/DomainMappingTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/DomainMappingTest.java
index 81ffdc5..1b3e804 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/DomainMappingTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/DomainMappingTest.java
@@ -26,6 +26,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import javax.mail.internet.MimeMessage;
 
 import org.apache.james.core.Username;
@@ -45,11 +47,11 @@ import org.apache.james.utils.TestIMAPClient;
 import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import io.restassured.specification.RequestSpecification;
 
@@ -69,22 +71,20 @@ public class DomainMappingTest {
     private MimeMessage message;
     private RequestSpecification webAdminApi;
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(CommonProcessors.rrtErrorEnabledTransport())
             .putProcessor(CommonProcessors.rrtErrorProcessor());
 
         jamesServer = TemporaryJamesServer.builder()
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         jamesServer.getProbe(DataProbeImpl.class).fluent()
@@ -104,7 +104,7 @@ public class DomainMappingTest {
             .build();
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingRelayTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingRelayTest.java
index 26b224a..7ad4f44 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingRelayTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingRelayTest.java
@@ -25,6 +25,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.hamcrest.Matchers.equalTo;
 
+import java.io.File;
+
 import javax.mail.internet.MimeMessage;
 
 import org.apache.james.core.builder.MimeMessageBuilder;
@@ -43,12 +45,11 @@ import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.apache.james.webadmin.routes.GroupsRoutes;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import io.restassured.specification.RequestSpecification;
 
@@ -65,17 +66,15 @@ public class GroupMappingRelayTest {
     private MimeMessage message;
     private RequestSpecification webAdminApi;
 
-    @ClassRule
+    @RegisterExtension
     public static final FakeSmtp fakeSmtp = FakeSmtp.withDefaultPort();
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(CommonProcessors.rrtErrorEnabledTransport()
                 .addMailet(MailetConfiguration.remoteDeliveryBuilder()
@@ -85,7 +84,7 @@ public class GroupMappingRelayTest {
 
         jamesServer = TemporaryJamesServer.builder()
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -101,9 +100,8 @@ public class GroupMappingRelayTest {
             .build();
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
-        fakeSmtp.clean();
         jamesServer.shutdown();
     }
 
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java
index ea0c288..6822f11 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/GroupMappingTest.java
@@ -26,6 +26,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import javax.mail.internet.MimeMessage;
 
 import org.apache.james.core.Username;
@@ -47,11 +49,11 @@ import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.apache.james.webadmin.routes.GroupsRoutes;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import io.restassured.specification.RequestSpecification;
 
@@ -73,22 +75,20 @@ public class GroupMappingTest {
     private DataProbe dataProbe;
     private RequestSpecification webAdminApi;
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(CommonProcessors.rrtErrorEnabledTransport())
             .putProcessor(CommonProcessors.rrtErrorProcessor());
 
         jamesServer = TemporaryJamesServer.builder()
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -111,7 +111,7 @@ public class GroupMappingTest {
             .build();
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
index 8c97801..08d79a1 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ICSAttachmentWorkflowTest.java
@@ -25,6 +25,7 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
 import java.nio.charset.StandardCharsets;
 import java.util.Optional;
 
@@ -41,23 +42,18 @@ import org.apache.james.mailets.configuration.ProcessorConfiguration;
 import org.apache.james.modules.protocols.ImapGuiceProbe;
 import org.apache.james.modules.protocols.SmtpGuiceProbe;
 import org.apache.james.probe.DataProbe;
-import org.apache.james.transport.mailets.amqp.AmqpRule;
+import org.apache.james.transport.mailets.amqp.AmqpExtension;
 import org.apache.james.transport.matchers.All;
 import org.apache.james.util.MimeMessageUtil;
-import org.apache.james.util.docker.DockerContainer;
-import org.apache.james.util.docker.Images;
-import org.apache.james.util.docker.RateLimiters;
 import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import com.google.common.collect.ImmutableList;
 import com.jayway.jsonpath.Configuration;
@@ -428,18 +424,12 @@ public class ICSAttachmentWorkflowTest {
             "END:VCALENDAR\r\n" +
             "";
 
-    @ClassRule
-    public static DockerContainer rabbitMqContainer = DockerContainer.fromName(Images.RABBITMQ)
-        .withAffinityToContainer()
-        .waitingFor(new HostPortWaitStrategy().withRateLimiter(RateLimiters.TWENTIES_PER_SECOND));
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
-    public AmqpRule amqpRule = new AmqpRule(rabbitMqContainer, EXCHANGE_NAME, ROUTING_KEY);
 
-    @Rule
+    @RegisterExtension
+    public static AmqpExtension amqpExtension = new AmqpExtension(EXCHANGE_NAME, ROUTING_KEY);
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
@@ -449,8 +439,8 @@ public class ICSAttachmentWorkflowTest {
     private MimeMessage messageWithThreeICSAttached;
     private MimeMessage yahooInvitationMessage;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.defaultMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.transport()
                 .addMailet(MailetConfiguration.builder()
@@ -483,7 +473,7 @@ public class ICSAttachmentWorkflowTest {
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
                     .mailet(AmqpForwardAttribute.class)
-                    .addProperty("uri", amqpRule.getAmqpUri())
+                    .addProperty("uri", amqpExtension.getAmqpUri())
                     .addProperty("exchange", EXCHANGE_NAME)
                     .addProperty("attribute", JSON_MAIL_ATTRIBUTE)
                     .addProperty("routing_key", ROUTING_KEY))
@@ -492,7 +482,7 @@ public class ICSAttachmentWorkflowTest {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -552,10 +542,9 @@ public class ICSAttachmentWorkflowTest {
             .build();
     }
 
-    @After
-    public void tearDown() throws Exception {
+    @AfterEach
+    public void tearDown() {
         jamesServer.shutdown();
-        amqpRule.readAll();
     }
 
     @Test
@@ -572,7 +561,7 @@ public class ICSAttachmentWorkflowTest {
             .select(TestIMAPClient.INBOX)
             .awaitMessage(awaitAtMostOneMinute);
 
-        assertThat(amqpRule.readContent()).isEmpty();
+        assertThat(amqpExtension.readContent()).isEmpty();
     }
 
     @Test
@@ -589,7 +578,7 @@ public class ICSAttachmentWorkflowTest {
             .select(TestIMAPClient.INBOX)
             .awaitMessage(awaitAtMostOneMinute);
 
-        Optional<String> content = amqpRule.readContent();
+        Optional<String> content = amqpExtension.readContent();
         assertThat(content).isPresent();
         DocumentContext jsonPath = toJsonPath(content.get());
         assertThat(jsonPath.<String>read("ical")).isEqualTo(ICS_1);
@@ -686,7 +675,7 @@ public class ICSAttachmentWorkflowTest {
             .select(TestIMAPClient.INBOX)
             .awaitMessage(awaitAtMostOneMinute);
 
-        Optional<String> content = amqpRule.readContent();
+        Optional<String> content = amqpExtension.readContent();
         assertThat(content).isPresent();
         DocumentContext jsonPath = toJsonPath(content.get());
         assertThat(jsonPath.<String>read("sender")).isEqualTo(FROM);
@@ -712,7 +701,7 @@ public class ICSAttachmentWorkflowTest {
             .select(TestIMAPClient.INBOX)
             .awaitMessage(awaitAtMostOneMinute);
 
-        Optional<String> content = amqpRule.readContent();
+        Optional<String> content = amqpExtension.readContent();
         assertThat(content).isPresent();
         DocumentContext jsonPath = toJsonPath(content.get());
         assertThat(jsonPath.<String>read("sender")).isEqualTo("obmlinagora@yahoo.fr");
@@ -760,15 +749,15 @@ public class ICSAttachmentWorkflowTest {
             .select(TestIMAPClient.INBOX)
             .awaitMessage(awaitAtMostOneMinute);
 
-        Optional<String> content1 = amqpRule.readContent();
+        Optional<String> content1 = amqpExtension.readContent();
         assertThat(content1).isPresent();
         DocumentContext jsonPath1 = toJsonPath(content1.get());
 
-        Optional<String> content2 = amqpRule.readContent();
+        Optional<String> content2 = amqpExtension.readContent();
         assertThat(content2).isPresent();
         DocumentContext jsonPath2 = toJsonPath(content2.get());
 
-        Optional<String> content3 = amqpRule.readContent();
+        Optional<String> content3 = amqpExtension.readContent();
         assertThat(content3).isPresent();
         DocumentContext jsonPath3 = toJsonPath(content3.get());
 
@@ -780,7 +769,7 @@ public class ICSAttachmentWorkflowTest {
                 "f1514f44bf39311568d640727cff54e819573448d09d2e5677987ff29caa01a9e047feb2aab16e43439a608f28671ab7c10e754ce92be513f8e04ae9ff15e65a9819cf285a6962bd",
                 "f1514f44bf39311568d640727cff54e819573448d09d2e5677987ff29caa01a9e047feb2aab16e43439a608f28671ab7c10e754ce92be513f8e04ae9ff15e65a9819cf285a6962be");
 
-        assertThat(amqpRule.readContent()).isEmpty();
+        assertThat(amqpExtension.readContent()).isEmpty();
     }
 
     @Test
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/IsOverQuotaMatcherTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/IsOverQuotaMatcherTest.java
index 9a5c45d..be89608 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/IsOverQuotaMatcherTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/IsOverQuotaMatcherTest.java
@@ -25,6 +25,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.core.quota.QuotaCountLimit;
 import org.apache.james.core.quota.QuotaSizeLimit;
@@ -42,11 +44,11 @@ import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
 import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.WebAdminUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import io.restassured.specification.RequestSpecification;
 
@@ -63,18 +65,16 @@ public class IsOverQuotaMatcherTest {
     private static final QuotaCountLimit SMALL_COUNT = QuotaCountLimit.count(0);
     private static final QuotaCountLimit LARGE_COUNT = QuotaCountLimit.count(100);
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
     
     private TemporaryJamesServer jamesServer;
     private RequestSpecification webAdminApi;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.defaultMailetContainerConfiguration()
                 .putProcessor(ProcessorConfiguration.transport()
                         .addMailet(MailetConfiguration.builder()
@@ -88,7 +88,7 @@ public class IsOverQuotaMatcherTest {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.IN_MEMORY_SERVER_AGGREGATE_MODULE)
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         webAdminApi = WebAdminUtils.spec(jamesServer.getProbe(WebAdminGuiceProbe.class).getWebAdminPort());
@@ -101,7 +101,7 @@ public class IsOverQuotaMatcherTest {
         dataProbe.addUser(BOUNCE_SENDER, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/MailReprocessingIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/MailReprocessingIntegrationTest.java
index a17929f..2ff4c8c 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/MailReprocessingIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/MailReprocessingIntegrationTest.java
@@ -31,6 +31,8 @@ import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMin
 import static org.apache.james.mailets.configuration.ProcessorConfiguration.TRANSPORT_PROCESSOR;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import org.apache.james.MemoryJamesServerMain;
 import org.apache.james.core.builder.MimeMessageBuilder;
 import org.apache.james.mailets.TemporaryJamesServer;
@@ -46,11 +48,11 @@ import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import com.google.inject.util.Modules;
 
@@ -60,17 +62,14 @@ public class MailReprocessingIntegrationTest {
     private static final MailRepositoryUrl REPOSITORY_A = MailRepositoryUrl.from("memory://var/mail/a");
     private static final MailRepositoryUrl REPOSITORY_B = MailRepositoryUrl.from("memory://var/mail/b");
 
-    @Rule
-    public TemporaryFolder folder = new TemporaryFolder();
-
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
     private RequestSpecification specification;
 
-    @Before
-    public void createJamesServer() throws Exception {
+    @BeforeEach
+    public void createJamesServer(@TempDir File temporaryFolder) throws Exception {
         MailetContainer.Builder mailets = TemporaryJamesServer.defaultMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.transport()
                     .addMailet(MailetConfiguration.BCC_STRIPPER)
@@ -87,7 +86,7 @@ public class MailReprocessingIntegrationTest {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(Modules.combine(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE, MemoryJamesServerMain.WEBADMIN_TESTING))
             .withMailetContainer(mailets)
-            .build(folder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         jamesServer.getProbe(DataProbeImpl.class)
@@ -100,7 +99,7 @@ public class MailReprocessingIntegrationTest {
         specification = WebAdminUtils.spec(jamesServer.getProbe(WebAdminGuiceProbe.class).getWebAdminPort());
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/SpamAssassinIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/SpamAssassinIntegrationTest.java
index 833d598..e25d25f 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/SpamAssassinIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/SpamAssassinIntegrationTest.java
@@ -28,6 +28,8 @@ import static org.apache.james.mailets.configuration.Constants.RECIPIENT2;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import javax.mail.MessagingException;
 
 import org.apache.james.core.builder.MimeMessageBuilder;
@@ -47,33 +49,30 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy;
 
 public class SpamAssassinIntegrationTest {
     private static final String SPAM_CONTENT = "XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X";
 
-    @ClassRule
+    @RegisterExtension
     public static DockerContainer spamAssassinContainer = DockerContainer.fromName(Images.SPAMASSASSIN)
         .withExposedPorts(783)
         .withAffinityToContainer()
         .waitingFor(new HostPortWaitStrategy().withRateLimiter(RateLimiters.TWENTIES_PER_SECOND));
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient messageReader = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         MailetContainer.Builder mailets = TemporaryJamesServer.defaultMailetContainerConfiguration()
             .putProcessor(
                 ProcessorConfiguration.transport()
@@ -86,7 +85,7 @@ public class SpamAssassinIntegrationTest {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(SMTP_AND_IMAP_MODULE)
             .withMailetContainer(mailets)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         jamesServer.getProbe(DataProbeImpl.class)
@@ -97,7 +96,7 @@ public class SpamAssassinIntegrationTest {
             .addUser(RECIPIENT2, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
index a80f1e0..5458448 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
@@ -25,6 +25,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import javax.mail.internet.MimeMessage;
 
 import org.apache.james.MemoryJamesServerMain;
@@ -42,27 +44,25 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class StripAttachmentTest {
     private static final String FROM = "fromUser@" + DEFAULT_DOMAIN;
     private static final String RECIPIENT = "touser@" + DEFAULT_DOMAIN;
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.defaultMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.transport()
                 .addMailet(MailetConfiguration.builder()
@@ -83,7 +83,7 @@ public class StripAttachmentTest {
         jamesServer = TemporaryJamesServer.builder()
             .withBase(MemoryJamesServerMain.SMTP_AND_IMAP_MODULE)
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -91,7 +91,7 @@ public class StripAttachmentTest {
         dataProbe.addUser(RECIPIENT, PASSWORD);
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ToRepositoryIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ToRepositoryIntegrationTest.java
index e016d19..79fb660 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ToRepositoryIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ToRepositoryIntegrationTest.java
@@ -25,6 +25,8 @@ import static org.apache.james.mailets.configuration.Constants.LOCALHOST_IP;
 import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 
+import java.io.File;
+
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.MailetConfiguration;
 import org.apache.james.mailets.configuration.MailetContainer;
@@ -43,11 +45,11 @@ import org.apache.james.utils.WebAdminGuiceProbe;
 import org.apache.james.webadmin.WebAdminUtils;
 import org.apache.james.webadmin.routes.MailRepositoriesRoutes;
 import org.apache.james.webadmin.routes.TasksRoutes;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 import io.restassured.specification.RequestSpecification;
 
@@ -55,19 +57,17 @@ public class ToRepositoryIntegrationTest {
     private static final String RECIPIENT = "touser@" + DEFAULT_DOMAIN;
     public static final MailRepositoryUrl CUSTOM_REPOSITORY = MailRepositoryUrl.from("memory://var/mail/custom/");
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
     private MailRepositoryProbeImpl probe;
     private RequestSpecification webAdminAPI;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    public void setup(@TempDir File temporaryFolder) throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.root()
                 .addMailet(MailetConfiguration.builder()
@@ -77,7 +77,7 @@ public class ToRepositoryIntegrationTest {
 
         jamesServer = TemporaryJamesServer.builder()
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
@@ -91,7 +91,7 @@ public class ToRepositoryIntegrationTest {
             .build();
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         jamesServer.shutdown();
     }
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ToSenderDomainRepositoryIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ToSenderDomainRepositoryIntegrationTest.java
index a6d6432..062a2b8 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ToSenderDomainRepositoryIntegrationTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/ToSenderDomainRepositoryIntegrationTest.java
@@ -25,6 +25,8 @@ import static org.apache.james.mailets.configuration.Constants.PASSWORD;
 import static org.apache.james.mailets.configuration.Constants.awaitAtMostOneMinute;
 import static org.assertj.core.api.Assertions.assertThat;
 
+import java.io.File;
+
 import org.apache.james.mailets.TemporaryJamesServer;
 import org.apache.james.mailets.configuration.MailetConfiguration;
 import org.apache.james.mailets.configuration.MailetContainer;
@@ -36,10 +38,10 @@ import org.apache.james.utils.DataProbeImpl;
 import org.apache.james.utils.MailRepositoryProbeImpl;
 import org.apache.james.utils.SMTPMessageSender;
 import org.apache.james.utils.TestIMAPClient;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.api.io.TempDir;
 
 public class ToSenderDomainRepositoryIntegrationTest {
 
@@ -48,16 +50,14 @@ public class ToSenderDomainRepositoryIntegrationTest {
     public static final MailRepositoryUrl DOMAIN_URL = MailRepositoryUrl.from(CUSTOM_REPOSITORY_PREFIX + DEFAULT_DOMAIN);
     public static final MailRepositoryUrl AWAIT_REPOSITORY_PATH = MailRepositoryUrl.from("memory://var/mail/await/");
 
-    @Rule
-    public TemporaryFolder temporaryFolder = new TemporaryFolder();
-    @Rule
+    @RegisterExtension
     public TestIMAPClient testIMAPClient = new TestIMAPClient();
-    @Rule
+    @RegisterExtension
     public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
 
     private TemporaryJamesServer jamesServer;
 
-    @After
+    @AfterEach
     public void tearDown() {
         if (jamesServer != null) {
             jamesServer.shutdown();
@@ -65,8 +65,8 @@ public class ToSenderDomainRepositoryIntegrationTest {
     }
 
     @Test
-    public void incomingMailShouldBeStoredInCorrespondingMailRepository() throws Exception {
-        startJamesServerWithMailetContainer(TemporaryJamesServer.simpleMailetContainerConfiguration()
+    public void incomingMailShouldBeStoredInCorrespondingMailRepository(@TempDir File temporaryFolder) throws Exception {
+        startJamesServerWithMailetContainer(temporaryFolder, TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.root()
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
@@ -85,8 +85,8 @@ public class ToSenderDomainRepositoryIntegrationTest {
     }
 
     @Test
-    public void incomingMailShouldBeStoredWhenRepositoryDoesNotExistAndAllowedToCreateRepository() throws Exception {
-        startJamesServerWithMailetContainer(TemporaryJamesServer.simpleMailetContainerConfiguration()
+    public void incomingMailShouldBeStoredWhenRepositoryDoesNotExistAndAllowedToCreateRepository(@TempDir File temporaryFolder) throws Exception {
+        startJamesServerWithMailetContainer(temporaryFolder, TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.root()
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
@@ -106,8 +106,8 @@ public class ToSenderDomainRepositoryIntegrationTest {
     }
 
     @Test
-    public void incomingMailShouldBeStoredWhenRepositoryExistsAndAllowedToCreateRepository() throws Exception {
-        startJamesServerWithMailetContainer(TemporaryJamesServer.simpleMailetContainerConfiguration()
+    public void incomingMailShouldBeStoredWhenRepositoryExistsAndAllowedToCreateRepository(@TempDir File temporaryFolder) throws Exception {
+        startJamesServerWithMailetContainer(temporaryFolder, TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.root()
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
@@ -129,8 +129,8 @@ public class ToSenderDomainRepositoryIntegrationTest {
     }
 
     @Test
-    public void incomingMailShouldBeIgnoredWhenRepositoryDoesNotExistAndNotAllowedToCreateRepository() throws Exception {
-        startJamesServerWithMailetContainer(TemporaryJamesServer.simpleMailetContainerConfiguration()
+    public void incomingMailShouldBeIgnoredWhenRepositoryDoesNotExistAndNotAllowedToCreateRepository(@TempDir File temporaryFolder) throws Exception {
+        startJamesServerWithMailetContainer(temporaryFolder, TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.root()
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
@@ -155,8 +155,8 @@ public class ToSenderDomainRepositoryIntegrationTest {
     }
 
     @Test
-    public void incomingMailShouldBeStoredWhenRepositoryExistsAndNotAllowedToCreateRepository() throws Exception {
-        startJamesServerWithMailetContainer(TemporaryJamesServer.simpleMailetContainerConfiguration()
+    public void incomingMailShouldBeStoredWhenRepositoryExistsAndNotAllowedToCreateRepository(@TempDir File temporaryFolder) throws Exception {
+        startJamesServerWithMailetContainer(temporaryFolder, TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.root()
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
@@ -178,8 +178,8 @@ public class ToSenderDomainRepositoryIntegrationTest {
     }
 
     @Test
-    public void incomingMailsShouldBeStoredInCorrespondingMailRepository() throws Exception {
-        startJamesServerWithMailetContainer(TemporaryJamesServer.simpleMailetContainerConfiguration()
+    public void incomingMailsShouldBeStoredInCorrespondingMailRepository(@TempDir File temporaryFolder) throws Exception {
+        startJamesServerWithMailetContainer(temporaryFolder, TemporaryJamesServer.simpleMailetContainerConfiguration()
             .putProcessor(ProcessorConfiguration.root()
                 .addMailet(MailetConfiguration.builder()
                     .matcher(All.class)
@@ -198,10 +198,10 @@ public class ToSenderDomainRepositoryIntegrationTest {
             .isEqualTo(2);
     }
 
-    private void startJamesServerWithMailetContainer(MailetContainer.Builder mailetContainer) throws Exception {
+    private void startJamesServerWithMailetContainer(File temporaryFolder, MailetContainer.Builder mailetContainer) throws Exception {
         jamesServer = TemporaryJamesServer.builder()
             .withMailetContainer(mailetContainer)
-            .build(temporaryFolder.newFolder());
+            .build(temporaryFolder);
         jamesServer.start();
 
         jamesServer.getProbe(DataProbeImpl.class)
diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/amqp/AmqpRule.java b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/amqp/AmqpExtension.java
similarity index 76%
rename from server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/amqp/AmqpRule.java
rename to server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/amqp/AmqpExtension.java
index 0dbd192..6a37166 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/amqp/AmqpRule.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/amqp/AmqpExtension.java
@@ -26,8 +26,16 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
 import org.apache.james.util.docker.DockerContainer;
+import org.apache.james.util.docker.Images;
+import org.apache.james.util.docker.RateLimiters;
 import org.awaitility.Awaitility;
+import org.junit.jupiter.api.extension.AfterAllCallback;
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
 import org.junit.rules.ExternalResource;
+import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy;
 
 import com.rabbitmq.client.BuiltinExchangeType;
 import com.rabbitmq.client.Channel;
@@ -35,8 +43,7 @@ import com.rabbitmq.client.Connection;
 import com.rabbitmq.client.ConnectionFactory;
 import com.rabbitmq.client.GetResponse;
 
-public class AmqpRule extends ExternalResource {
-
+public class AmqpExtension implements BeforeAllCallback, AfterAllCallback, AfterEachCallback {
     private static final boolean AUTO_ACK = true;
 
     private final DockerContainer rabbitMqContainer;
@@ -47,14 +54,18 @@ public class AmqpRule extends ExternalResource {
     private Connection connection;
     private String amqpUri;
 
-    public AmqpRule(DockerContainer rabbitMqContainer, String exchangeName, String routingKey) {
-        this.rabbitMqContainer = rabbitMqContainer;
+    public AmqpExtension(String exchangeName, String routingKey) {
+        this.rabbitMqContainer = DockerContainer.fromName(Images.RABBITMQ)
+            .withAffinityToContainer()
+            .waitingFor(new HostPortWaitStrategy()
+                .withRateLimiter(RateLimiters.TWENTIES_PER_SECOND));;
         this.exchangeName = exchangeName;
         this.routingKey = routingKey;
     }
 
     @Override
-    protected void before() throws Throwable {
+    public void beforeAll(ExtensionContext extensionContext) throws Exception {
+        rabbitMqContainer.start();
         amqpUri = "amqp://" + rabbitMqContainer.getContainerIp();
         ConnectionFactory factory = new ConnectionFactory();
         factory.setUri(amqpUri);
@@ -66,6 +77,22 @@ public class AmqpRule extends ExternalResource {
         channel.queueBind(queueName, exchangeName, routingKey);
     }
 
+    @Override
+    public void afterAll(ExtensionContext extensionContext) {
+        try {
+            channel.close();
+            connection.close();
+            rabbitMqContainer.stop();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    public void afterEach(ExtensionContext extensionContext) throws Exception {
+        readAll();
+    }
+
     public String getAmqpUri() {
         return amqpUri;
     }
@@ -86,16 +113,6 @@ public class AmqpRule extends ExternalResource {
             .map(GetResponse::getBody);
     }
 
-    @Override
-    protected void after() {
-        try {
-            channel.close();
-            connection.close();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
     private void waitingForRabbitToBeReady(ConnectionFactory factory) {
         Awaitility
             .await()
diff --git a/server/testing/src/main/java/org/apache/james/util/docker/DockerContainer.java b/server/testing/src/main/java/org/apache/james/util/docker/DockerContainer.java
index d14d785..9fbeccd 100644
--- a/server/testing/src/main/java/org/apache/james/util/docker/DockerContainer.java
+++ b/server/testing/src/main/java/org/apache/james/util/docker/DockerContainer.java
@@ -26,6 +26,9 @@ import java.util.Map;
 import java.util.function.Consumer;
 
 import org.junit.AssumptionViolatedException;
+import org.junit.jupiter.api.extension.AfterAllCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
 import org.junit.rules.TestRule;
 import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
@@ -42,7 +45,7 @@ import org.testcontainers.images.builder.ImageFromDockerfile;
 import com.github.dockerjava.api.model.ContainerNetwork;
 import com.google.common.base.Strings;
 
-public class DockerContainer implements TestRule {
+public class DockerContainer implements TestRule, BeforeAllCallback, AfterAllCallback {
     private static final Logger LOGGER = LoggerFactory.getLogger(DockerContainer.class);
     private static final String DOCKER_CONTAINER = "DOCKER_CONTAINER";
 
@@ -187,4 +190,13 @@ public class DockerContainer implements TestRule {
         };
     }
 
+    @Override
+    public void afterAll(ExtensionContext extensionContext) {
+        container.stop();
+    }
+
+    @Override
+    public void beforeAll(ExtensionContext extensionContext) {
+        container.start();
+    }
 }
diff --git a/server/testing/src/main/java/org/apache/james/utils/FakeSmtp.java b/server/testing/src/main/java/org/apache/james/utils/FakeSmtp.java
index 89c15d1..416806c 100644
--- a/server/testing/src/main/java/org/apache/james/utils/FakeSmtp.java
+++ b/server/testing/src/main/java/org/apache/james/utils/FakeSmtp.java
@@ -30,6 +30,10 @@ import java.util.function.Consumer;
 import org.apache.james.util.docker.DockerContainer;
 import org.apache.james.util.docker.Images;
 import org.apache.james.util.docker.RateLimiters;
+import org.junit.jupiter.api.extension.AfterAllCallback;
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
 import org.junit.rules.TestRule;
 import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
@@ -42,7 +46,7 @@ import io.restassured.response.ValidatableResponse;
 import io.restassured.specification.RequestSpecification;
 import io.restassured.specification.ResponseSpecification;
 
-public class FakeSmtp implements TestRule {
+public class FakeSmtp implements TestRule, BeforeAllCallback, AfterAllCallback, AfterEachCallback {
     public static void clean(RequestSpecification requestSpecification) {
         given(requestSpecification, RESPONSE_SPECIFICATION)
             .get("/api/email")
@@ -89,6 +93,21 @@ public class FakeSmtp implements TestRule {
         return container.apply(statement, description);
     }
 
+    @Override
+    public void afterAll(ExtensionContext extensionContext) {
+        container.stop();
+    }
+
+    @Override
+    public void afterEach(ExtensionContext extensionContext) {
+        clean();
+    }
+
+    @Override
+    public void beforeAll(ExtensionContext extensionContext) {
+        container.start();
+    }
+
     public void assertEmailReceived(Consumer<ValidatableResponse> expectations) {
         expectations.accept(
             given(requestSpecification(), RESPONSE_SPECIFICATION)


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