JAMES-2361 migrate mailet/standard to junit 5

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

Branch: refs/heads/master
Commit: 1e365b3edc2f8c53726621fb2c049017435a205c
Parents: a4c9f2e
Author: Matthieu Baechler <matth...@apache.org>
Authored: Wed Mar 21 12:02:33 2018 +0100
Committer: Matthieu Baechler <matth...@apache.org>
Committed: Mon Mar 26 14:57:23 2018 +0200

----------------------------------------------------------------------
 mailet/standard/pom.xml                         |  20 +-
 .../mailets/AddDeliveredToHeaderTest.java       |   6 +-
 .../james/transport/mailets/AddFooterTest.java  | 105 +++++-----
 .../transport/mailets/AddSubjectPrefixTest.java |  30 ++-
 .../mailets/AmqpForwardAttributeTest.java       |  52 +++--
 .../transport/mailets/ContactExtractorTest.java |   6 +-
 .../transport/mailets/ContentReplacerTest.java  |   2 +-
 .../james/transport/mailets/LogMessageTest.java |  37 ++--
 .../MailAttributesListToMimeHeadersTest.java    |  66 +++----
 .../MailAttributesToMimeHeadersTest.java        |  53 +++--
 .../transport/mailets/MappingArgumentTest.java  |  42 ++--
 .../mailets/MimeDecodingMailetTest.java         |  39 ++--
 .../james/transport/mailets/NullTest.java       |   6 +-
 .../james/transport/mailets/OnlyTextTest.java   |  14 +-
 .../transport/mailets/PatternExtractorTest.java |  44 ++---
 .../transport/mailets/PostmasterAliasTest.java  |   6 +-
 .../mailets/RecipientToLowerCaseTest.java       |   6 +-
 .../mailets/RemoveAllMailAttributesTest.java    |   6 +-
 .../mailets/RemoveMailAttributeTest.java        |  33 ++--
 .../mailets/RemoveMimeHeaderByPrefixTest.java   |  36 ++--
 .../transport/mailets/RemoveMimeHeaderTest.java |  32 ++--
 .../transport/mailets/ReplaceContentTest.java   |  31 ++-
 .../transport/mailets/SetMailAttributeTest.java |  20 +-
 .../transport/mailets/SetMimeHeaderTest.java    |  45 ++---
 .../transport/mailets/StripAttachmentTest.java  | 191 +++++++++----------
 .../transport/mailets/ToProcessorTest.java      |  34 ++--
 .../james/transport/mailets/UnwrapTextTest.java |  28 +--
 .../mailets/UseHeaderRecipientsTest.java        |  42 ++--
 .../mailets/utils/MimeMessageModifierTest.java  |   2 +-
 .../mailets/utils/MimeMessageUtilsTest.java     |   2 +-
 .../matchers/AbstractHasMailAttributeTest.java  |  36 ++--
 .../james/transport/matchers/AllTest.java       |   6 +-
 .../transport/matchers/FetchedFromTest.java     |   6 +-
 .../transport/matchers/HasAttachmentTest.java   |   6 +-
 .../transport/matchers/HasExceptionTest.java    |   6 +-
 .../james/transport/matchers/HasHeaderTest.java |   6 +-
 .../matchers/HasHeaderWithPrefixTest.java       |  50 +++--
 .../matchers/HasMailAttributeTest.java          |   4 -
 .../HasMailAttributeWithValueRegexTest.java     |  25 ++-
 .../matchers/HasMailAttributeWithValueTest.java |  11 +-
 .../transport/matchers/HasMimeTypeTest.java     |   6 +-
 .../transport/matchers/HostIsLocalTest.java     |   6 +-
 .../james/transport/matchers/HostIsTest.java    |   6 +-
 .../matchers/IsSingleRecipientTest.java         |   6 +-
 .../transport/matchers/NESSpamCheckTest.java    |   6 +-
 .../matchers/RecipientIsLocalTest.java          |   6 +-
 .../matchers/RecipientIsRegexTest.java          |  51 +++--
 .../transport/matchers/RecipientIsTest.java     |  42 ++--
 .../transport/matchers/RelayLimitTest.java      |  59 +++---
 .../matchers/SMTPAuthSuccessfulTest.java        |   6 +-
 .../transport/matchers/SMTPAuthUserIsTest.java  |   5 +-
 .../matchers/SMTPIsAuthNetworkTest.java         |   6 +-
 .../matchers/SenderHostIsLocalTest.java         |   6 +-
 .../transport/matchers/SenderHostIsTest.java    |  40 ++--
 .../transport/matchers/SenderIsLocalTest.java   |   6 +-
 .../transport/matchers/SenderIsNullTest.java    |  19 +-
 .../transport/matchers/SenderIsRegexTest.java   |  53 +++--
 .../james/transport/matchers/SenderIsTest.java  |  42 ++--
 .../transport/matchers/SentByMailetTest.java    |   6 +-
 .../transport/matchers/SizeGreaterThanTest.java |  48 +++--
 .../james/transport/matchers/SubjectIsTest.java |   6 +-
 .../matchers/SubjectStartsWithTest.java         |   6 +-
 .../transport/matchers/TooManyLinesTest.java    |  88 ++++-----
 .../matchers/TooManyRecipientsTest.java         |  92 +++++----
 .../james/transport/matchers/UserIsTest.java    |  42 ++--
 .../util/MailAddressCollectionReaderTest.java   |  46 ++---
 pom.xml                                         |   5 +
 67 files changed, 898 insertions(+), 1004 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/pom.xml
----------------------------------------------------------------------
diff --git a/mailet/standard/pom.xml b/mailet/standard/pom.xml
index 8aab675..944dafa 100644
--- a/mailet/standard/pom.xml
+++ b/mailet/standard/pom.xml
@@ -87,11 +87,6 @@
             <artifactId>commons-io</artifactId>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>net.javacrumbs.json-unit</groupId>
             <artifactId>json-unit-fluent</artifactId>
             <scope>test</scope>
@@ -115,6 +110,21 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-params</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.platform</groupId>
+            <artifactId>junit-platform-launcher</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddDeliveredToHeaderTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddDeliveredToHeaderTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddDeliveredToHeaderTest.java
index 4e95400..168df21 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddDeliveredToHeaderTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddDeliveredToHeaderTest.java
@@ -26,14 +26,14 @@ import org.apache.mailet.base.MailAddressFixture;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class AddDeliveredToHeaderTest {
 
     private AddDeliveredToHeader testee;
 
-    @Before
+    @BeforeEach
     public void setUp() throws Exception {
         testee = new AddDeliveredToHeader();
         testee.init(FakeMailetConfig.builder()

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddFooterTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddFooterTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddFooterTest.java
index 9949b48..b5e0abb 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddFooterTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddFooterTest.java
@@ -20,13 +20,13 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import java.io.IOException;
-import java.util.Collection;
 import java.util.List;
-import java.util.Set;
+import java.util.stream.Stream;
 
 import javax.mail.MessagingException;
 
@@ -35,34 +35,25 @@ import org.apache.mailet.Mailet;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
 import org.apache.mailet.base.test.MailUtil;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
 
-@RunWith(Parameterized.class)
-public class AddFooterTest {
+class AddFooterTest {
 
     private static final String MY_FOOTER = "my footer";
-    @Rule public ExpectedException exception = ExpectedException.none();
-    
-    private final String javaCharset;
-    private final String javaMailCharset;
+
     private Mailet mailet;
     
-    @Parameters
-    public static Collection<String[]> data() {
+
+    private static Stream<Arguments> charsetTuples() {
         //javamail has its own charset handling logic, it needs to be exercised
-        List<String[]> charsets = Lists.newArrayList();
-        Set<String> charsetNamesToTest = Sets.newHashSet(
+        List<String> charsetNamesToTest = Lists.newArrayList(
                 "ANSI_X3.4-1968", 
                 "iso-ir-6", 
                 "ANSI_X3.4-1986", 
@@ -74,25 +65,17 @@ public class AddFooterTest {
                 "IBM367", 
                 "cp367",
                 "csASCII");
-        Set<List<String>> cartesianProduct = 
Sets.cartesianProduct(ImmutableList.of(charsetNamesToTest, charsetNamesToTest));
-        for (List<String> pair: cartesianProduct) {
-            charsets.add(new String[]{pair.get(0), pair.get(1)});
-        }
-        return charsets;
+        return charsetNamesToTest.stream().flatMap(from -> 
charsetNamesToTest.stream().map(to -> Arguments.of(from, to)));
     }
     
-    public AddFooterTest(String javaCharset, String javaMailCharset) {
-        this.javaCharset = javaCharset;
-        this.javaMailCharset = javaMailCharset;
-    }
-    
-    @Before
-    public void setup() {
+    @BeforeEach
+    void setup() {
         mailet = new AddFooter();
     }
-    
-    @Test
-    public void shouldAddFooterWhenQuotedPrintableTextPlainMessage() throws 
MessagingException, IOException {
+
+    @ParameterizedTest
+    @MethodSource("charsetTuples")
+    void shouldAddFooterWhenQuotedPrintableTextPlainMessage(String 
javaCharset, String javaMailCharset) throws MessagingException, IOException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("text", "------ " + MY_FOOTER + " à/€ ------")
@@ -116,8 +99,9 @@ public class AddFooterTest {
         assertThat(MailUtil.toString(mail, 
javaCharset)).endsWith(expectedFooter);
     }
 
-    @Test
-    public void shouldEnsureCarriageReturnWhenAddFooterWithTextPlainMessage() 
throws MessagingException, IOException {
+    @ParameterizedTest
+    @MethodSource("charsetTuples")
+    void shouldEnsureCarriageReturnWhenAddFooterWithTextPlainMessage(String 
javaCharset, String javaMailCharset) throws MessagingException, IOException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("text", "------ " + MY_FOOTER + " à/€ ------")
@@ -140,9 +124,10 @@ public class AddFooterTest {
 
         assertThat(MailUtil.toString(mail, javaCharset)).endsWith("\r\n" + 
expectedFooter);
     }
-    
-    @Test
-    public void shouldNotAddFooterWhenUnsupportedEncoding() throws 
MessagingException, IOException {
+
+    @ParameterizedTest
+    @MethodSource("charsetTuples")
+    void shouldNotAddFooterWhenUnsupportedEncoding(String javaCharset, String 
javaMailCharset) throws MessagingException, IOException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("text", "------ " + MY_FOOTER + " à/€ ------")
@@ -164,8 +149,9 @@ public class AddFooterTest {
         assertThat(MailUtil.toString(mail, 
javaCharset)).doesNotContain(MY_FOOTER);
     }
 
-    @Test
-    public void shouldNotAddFooterWhenUnsupportedTextContentType() throws 
MessagingException, IOException {
+    @ParameterizedTest
+    @MethodSource("charsetTuples")
+    void shouldNotAddFooterWhenUnsupportedTextContentType(String javaCharset, 
String javaMailCharset) throws MessagingException, IOException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("text", "------ " + MY_FOOTER + " à/€ ------")
@@ -191,8 +177,9 @@ public class AddFooterTest {
      * Test for JAMES-443
      * This should not add the header and should leave the multipart/mixed 
Content-Type intact
      */
-    @Test
-    public void shouldNotAddFooterWhenNestedUnsupportedMultipart() throws 
MessagingException, IOException {
+    @ParameterizedTest
+    @MethodSource("charsetTuples")
+    void shouldNotAddFooterWhenNestedUnsupportedMultipart(String javaCharset, 
String javaMailCharset) throws MessagingException, IOException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("text", "------ " + MY_FOOTER + " à/€ ------")
@@ -227,8 +214,9 @@ public class AddFooterTest {
     /*
      * Test for JAMES-368
      */
-    @Test
-    public void shouldAddFooterWhenMultipartRelatedHtmlMessage() throws 
MessagingException, IOException {
+    @ParameterizedTest
+    @MethodSource("charsetTuples")
+    void shouldAddFooterWhenMultipartRelatedHtmlMessage(String javaCharset, 
String javaMailCharset) throws MessagingException, IOException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("text", "------ " + MY_FOOTER + " à/€ ------")
@@ -278,9 +266,10 @@ public class AddFooterTest {
 
         assertThat(MailUtil.toString(mail, 
javaCharset)).contains(expectedFooter);
     }
-    
-    @Test
-    public void shouldAddFooterWhenMultipartAlternivateMessage() throws 
MessagingException,
+
+    @ParameterizedTest
+    @MethodSource("charsetTuples")
+    void shouldAddFooterWhenMultipartAlternivateMessage(String javaCharset, 
String javaMailCharset) throws MessagingException,
             IOException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
@@ -316,8 +305,9 @@ public class AddFooterTest {
         assertThat(MailUtil.toString(mail, javaCharset)).matches("(.|\n|\r)*" 
+ MY_FOOTER + "(.|\n|\r)*" + MY_FOOTER + "(.|\n|\r)*");
     }
 
-    @Test
-    public void shouldAddFooterWhenHtmlMessageWithMixedCaseBodyTag() throws 
MessagingException,
+    @ParameterizedTest
+    @MethodSource("charsetTuples")
+    void shouldAddFooterWhenHtmlMessageWithMixedCaseBodyTag(String 
javaCharset, String javaMailCharset) throws MessagingException,
             IOException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
@@ -343,8 +333,9 @@ public class AddFooterTest {
         assertThat(MailUtil.toString(mail, javaCharset)).contains(htmlContent);
     }
 
-    @Test
-    public void shouldAddFooterWhenHtmlMessageWithNoBodyTag() throws 
MessagingException,
+    @ParameterizedTest
+    @MethodSource("charsetTuples")
+    void shouldAddFooterWhenHtmlMessageWithNoBodyTag(String javaCharset, 
String javaMailCharset) throws MessagingException,
             IOException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
@@ -373,7 +364,7 @@ public class AddFooterTest {
     
     @SuppressWarnings("unchecked")
     @Test
-    public void shouldThrowMessagingExceptionWhenIOExceptionReadingMessage() 
throws MessagingException {
+    void shouldThrowMessagingExceptionWhenIOExceptionReadingMessage() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("text", "------ " + MY_FOOTER + " à/€ ------")
@@ -382,8 +373,6 @@ public class AddFooterTest {
         
         Mail mail = mock(Mail.class);
         when(mail.getMessage()).thenThrow(IOException.class);
-        exception.expect(MessagingException.class);
-        
-        mailet.service(mail);
+        assertThatThrownBy(() -> 
mailet.service(mail)).isInstanceOf(MessagingException.class);
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddSubjectPrefixTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddSubjectPrefixTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddSubjectPrefixTest.java
index 5799c42..b351544 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddSubjectPrefixTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/AddSubjectPrefixTest.java
@@ -21,6 +21,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
@@ -29,24 +30,20 @@ import org.apache.mailet.Mailet;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
 import org.apache.mailet.base.test.MailUtil;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class AddSubjectPrefixTest {
+class AddSubjectPrefixTest {
 
-    @Rule public ExpectedException expectedException = 
ExpectedException.none();
-    
     private Mailet mailet;
 
-    @Before
-    public void setup() {
+    @BeforeEach
+    void setup() {
         mailet = new AddSubjectPrefix();
     }
     
     @Test
-    public void shouldAddPrefixToSubject() throws MessagingException {
+    void shouldAddPrefixToSubject() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("subjectPrefix", "JUNIT")
@@ -63,7 +60,7 @@ public class AddSubjectPrefixTest {
 
     
     @Test
-    public void shouldAddPrefixToEncodedSubject() throws MessagingException {
+    void shouldAddPrefixToEncodedSubject() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("subjectPrefix", "Русский")
@@ -82,7 +79,7 @@ public class AddSubjectPrefixTest {
 
     
     @Test
-    public void shouldDefinePrefixAsSubjectWhenNoSubject() throws 
MessagingException {
+    void shouldDefinePrefixAsSubjectWhenNoSubject() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("subjectPrefix", "JUNIT")
@@ -99,7 +96,7 @@ public class AddSubjectPrefixTest {
     }
 
     @Test
-    public void shouldDefinePrefixAsSubjectWhenEmptySubject() throws 
MessagingException {
+    void shouldDefinePrefixAsSubjectWhenEmptySubject() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("subjectPrefix", "JUNIT")
@@ -115,14 +112,13 @@ public class AddSubjectPrefixTest {
     }
     
     @Test
-    public void shouldThrowWhenEmptyPrefix() throws MessagingException {
+    void shouldThrowWhenEmptyPrefix() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("subjectPrefix", "")
                 .build();
 
-        expectedException.expect(MessagingException.class);
-
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> mailet.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
index 29f873b..4b549d2 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/AmqpForwardAttributeTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
@@ -37,10 +38,8 @@ import org.apache.mailet.MailetContext;
 import org.apache.mailet.MailetException;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.mockito.ArgumentCaptor;
 import org.slf4j.Logger;
 
@@ -55,7 +54,7 @@ import com.rabbitmq.client.Connection;
 import com.rabbitmq.client.ConnectionFactory;
 import com.rabbitmq.client.ShutdownSignalException;
 
-public class AmqpForwardAttributeTest {
+class AmqpForwardAttributeTest {
 
     private static final String MAIL_ATTRIBUTE = "ampq.attachments";
     private static final String EXCHANGE_NAME = "exchangeName";
@@ -64,18 +63,14 @@ public class AmqpForwardAttributeTest {
     private static final byte[] ATTACHMENT_CONTENT = "Attachment 
content".getBytes(StandardCharsets.UTF_8);
     private static final ImmutableMap<String, byte[]> ATTRIBUTE_CONTENT = 
ImmutableMap.of("attachment1.txt", ATTACHMENT_CONTENT);
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private AmqpForwardAttribute mailet;
-    private Logger logger;
     private MailetContext mailetContext;
     private FakeMailetConfig mailetConfig;
 
-    @Before
+    @BeforeEach
     public void setUp() throws Exception {
         mailet = new AmqpForwardAttribute();
-        logger = mock(Logger.class);
+        Logger logger = mock(Logger.class);
         mailetContext = FakeMailContext.builder()
                 .logger(logger)
                 .build();
@@ -90,40 +85,40 @@ public class AmqpForwardAttributeTest {
     }
 
     @Test
-    public void initShouldThrowWhenNoUriParameter() throws MessagingException {
+    void initShouldThrowWhenNoUriParameter() {
         FakeMailetConfig customMailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .mailetContext(mailetContext)
                 .build();
-        expectedException.expect(MailetException.class);
-        mailet.init(customMailetConfig);
+        assertThatThrownBy(() -> mailet.init(customMailetConfig))
+            .isInstanceOf(MailetException.class);
     }
 
     @Test
-    public void initShouldThrowWhenNoExchangeParameter() throws 
MessagingException {
+    void initShouldThrowWhenNoExchangeParameter() {
         FakeMailetConfig customMailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .mailetContext(mailetContext)
                 .setProperty("uri", AMQP_URI)
                 .build();
-        expectedException.expect(MailetException.class);
-        mailet.init(customMailetConfig);
+        assertThatThrownBy(() -> mailet.init(customMailetConfig))
+            .isInstanceOf(MailetException.class);
     }
 
     @Test
-    public void initShouldThrowWhenNoAttributeParameter() throws 
MessagingException {
+    void initShouldThrowWhenNoAttributeParameter() {
         FakeMailetConfig customMailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .mailetContext(mailetContext)
                 .setProperty("uri", AMQP_URI)
                 .setProperty("exchange", EXCHANGE_NAME)
                 .build();
-        expectedException.expect(MailetException.class);
-        mailet.init(customMailetConfig);
+        assertThatThrownBy(() -> mailet.init(customMailetConfig))
+            .isInstanceOf(MailetException.class);
     }
 
     @Test
-    public void initShouldThrowWhenInvalidUri() throws MessagingException {
+    void initShouldThrowWhenInvalidUri() {
         FakeMailetConfig customMailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .mailetContext(mailetContext)
@@ -131,17 +126,17 @@ public class AmqpForwardAttributeTest {
                 .setProperty("exchange", EXCHANGE_NAME)
                 .setProperty("attribute", MAIL_ATTRIBUTE)
                 .build();
-        expectedException.expect(MailetException.class);
-        mailet.init(customMailetConfig);
+        assertThatThrownBy(() -> mailet.init(customMailetConfig))
+            .isInstanceOf(MailetException.class);
     }
 
     @Test
-    public void getMailetInfoShouldReturnInfo() {
+    void getMailetInfoShouldReturnInfo() {
         assertThat(mailet.getMailetInfo()).isEqualTo("AmqpForwardAttribute");
     }
 
     @Test
-    public void 
initShouldIntializeEmptyRoutingKeyWhenAllParametersButRoutingKey() throws 
MessagingException {
+    void initShouldIntializeEmptyRoutingKeyWhenAllParametersButRoutingKey() 
throws MessagingException {
         FakeMailetConfig customMailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .mailetContext(mailetContext)
@@ -155,7 +150,7 @@ public class AmqpForwardAttributeTest {
     }
 
     @Test
-    public void initShouldNotThrowWithAllParameters() throws 
MessagingException {
+    void initShouldNotThrowWithAllParameters() throws MessagingException {
         mailet.init(mailetConfig);
     }
 
@@ -180,9 +175,8 @@ public class AmqpForwardAttributeTest {
         Mail mail = mock(Mail.class);
         when(mail.getAttribute(MAIL_ATTRIBUTE)).thenReturn(2);
 
-        expectedException.expect(MailetException.class);
-
-        mailet.service(mail);
+        assertThatThrownBy(() -> mailet.service(mail))
+            .isInstanceOf(MailetException.class);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
index af54793..dc33e0b 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContactExtractorTest.java
@@ -35,8 +35,8 @@ import org.apache.mailet.MailetException;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import com.fasterxml.jackson.core.JsonGenerationException;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -51,7 +51,7 @@ public class ContactExtractorTest {
     private MailetContext mailetContext;
     private FakeMailetConfig mailetConfig;
 
-    @Before
+    @BeforeEach
     public void setUp() throws Exception {
         mailet = new ContactExtractor();
         mailetContext = FakeMailContext.builder()

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContentReplacerTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContentReplacerTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContentReplacerTest.java
index 6413786..c9dc99b 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContentReplacerTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/ContentReplacerTest.java
@@ -31,7 +31,7 @@ import java.util.regex.Pattern;
 import javax.mail.internet.MimeMessage;
 
 import org.apache.mailet.Mail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/LogMessageTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/LogMessageTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/LogMessageTest.java
index 920b5c5..ef03a8f 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/LogMessageTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/LogMessageTest.java
@@ -37,24 +37,19 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 
-public class LogMessageTest {
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
+class LogMessageTest {
 
     private LogMessage mailet;
     private FakeMailContext mailContext;
     private Logger logger;
 
 
-    @Before
-    public void setup() {
+    @BeforeEach
+    void setup() {
         logger = mock(Logger.class);
         when(logger.isInfoEnabled()).thenReturn(true);
         mailContext = FakeMailContext.builder()
@@ -64,12 +59,12 @@ public class LogMessageTest {
     }
 
     @Test
-    public void getMailetInfoShouldReturnValue() {
+    void getMailetInfoShouldReturnValue() {
         assertThat(mailet.getMailetInfo()).isEqualTo("LogHeaders Mailet");
     }
 
     @Test
-    public void initShouldIgnoreExceptions() throws Exception {
+    void initShouldIgnoreExceptions() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("LogContext")
                 .mailetContext(mailContext)
@@ -79,7 +74,7 @@ public class LogMessageTest {
     }
 
     @Test
-    public void serviceShouldFailWhenMailHasNoStream() throws Exception {
+    void serviceShouldFailWhenMailHasNoStream() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("LogContext")
                 .mailetContext(mailContext)
@@ -101,7 +96,7 @@ public class LogMessageTest {
     }
 
     @Test
-    public void serviceShouldLog() throws Exception {
+    void serviceShouldLog() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("LogContext")
                 .mailetContext(mailContext)
@@ -120,7 +115,7 @@ public class LogMessageTest {
     }
 
     @Test
-    public void serviceShouldLogWhenExceptionOccured() throws Exception {
+    void serviceShouldLogWhenExceptionOccured() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("LogContext")
                 .mailetContext(mailContext)
@@ -142,7 +137,7 @@ public class LogMessageTest {
     }
 
     @Test
-    public void serviceShouldSetTheMailStateWhenPassThroughIsFalse() throws 
Exception {
+    void serviceShouldSetTheMailStateWhenPassThroughIsFalse() throws Exception 
{
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("LogContext")
                 .mailetContext(mailContext)
@@ -157,7 +152,7 @@ public class LogMessageTest {
     }
 
     @Test
-    public void serviceShouldNotChangeTheMailStateWhenPassThroughIsTrue() 
throws Exception {
+    void serviceShouldNotChangeTheMailStateWhenPassThroughIsTrue() throws 
Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("LogContext")
                 .mailetContext(mailContext)
@@ -173,7 +168,7 @@ public class LogMessageTest {
     }
 
     @Test
-    public void serviceShouldNotLogHeadersWhenFalse() throws Exception {
+    void serviceShouldNotLogHeadersWhenFalse() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("LogContext")
                 .mailetContext(mailContext)
@@ -190,7 +185,7 @@ public class LogMessageTest {
     }
 
     @Test
-    public void serviceShouldNotLogBodyWhenFalse() throws Exception {
+    void serviceShouldNotLogBodyWhenFalse() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("LogContext")
                 .mailetContext(mailContext)
@@ -209,7 +204,7 @@ public class LogMessageTest {
     }
 
     @Test
-    public void serviceShouldNotLogFullBodyWhenBodyMaxIsSet() throws Exception 
{
+    void serviceShouldNotLogFullBodyWhenBodyMaxIsSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("LogContext")
                 .mailetContext(mailContext)
@@ -229,7 +224,7 @@ public class LogMessageTest {
     }
 
     @Test
-    public void serviceShouldLogAdditionalCommentWhenCommentIsSet() throws 
Exception {
+    void serviceShouldLogAdditionalCommentWhenCommentIsSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("LogContext")
                 .mailetContext(mailContext)

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeadersTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeadersTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeadersTest.java
index 1dad2bb..1849155 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeadersTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesListToMimeHeadersTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.ArrayList;
 
@@ -30,14 +31,12 @@ import org.apache.mailet.Mailet;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
 import org.apache.mailet.base.test.MailUtil;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
-public class MailAttributesListToMimeHeadersTest {
+class MailAttributesListToMimeHeadersTest {
 
     private static final String VALUE_1_1 = "test1.1";
     private static final String VALUE_1_2 = "test1.2";
@@ -51,40 +50,36 @@ public class MailAttributesListToMimeHeadersTest {
     private static final String HEADER_NAME1 = "JUNIT";
     private static final String HEADER_NAME2 = "JUNIT2";
 
-    @Rule public ExpectedException expectedException = 
ExpectedException.none();
-
     private Mailet mailet;
 
-    @Before
-    public void setup() {
+    @BeforeEach
+    void setup() {
         mailet = new MailAttributesListToMimeHeaders();
     }
 
     @Test
-    public void shouldThrowMessagingExceptionIfMappingIsNotGiven() throws 
MessagingException {
-        expectedException.expect(MessagingException.class);
-
+    void shouldThrowMessagingExceptionIfMappingIsNotGiven() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .build();
 
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> mailet.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void shouldThrowMessagingExceptionIfMappingIsEmpty() throws 
MessagingException {
-        expectedException.expect(MessagingException.class);
-
+    void shouldThrowMessagingExceptionIfMappingIsEmpty() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("simplemmapping", "")
             .build();
 
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> mailet.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void shouldIgnoreAttributeOfMappingThatDoesNotExistOnTheMessage() 
throws MessagingException {
+    void shouldIgnoreAttributeOfMappingThatDoesNotExistOnTheMessage() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("simplemapping",
@@ -106,7 +101,7 @@ public class MailAttributesListToMimeHeadersTest {
     }
 
     @Test
-    public void shouldWorkWithMappingWithASingleBinding() throws 
MessagingException {
+    void shouldWorkWithMappingWithASingleBinding() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("simplemapping",
@@ -127,7 +122,7 @@ public class MailAttributesListToMimeHeadersTest {
     }
 
     @Test
-    public void shouldIgnoreNullValueInsideList() throws MessagingException {
+    void shouldIgnoreNullValueInsideList() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("simplemapping",
@@ -136,7 +131,7 @@ public class MailAttributesListToMimeHeadersTest {
 
         mailet.init(mailetConfig);
 
-        ArrayList<String> listWithNull = new ArrayList<String>();
+        ArrayList<String> listWithNull = new ArrayList<>();
         listWithNull.add("1");
         listWithNull.add(null);
         listWithNull.add("2");
@@ -152,7 +147,7 @@ public class MailAttributesListToMimeHeadersTest {
     }
 
     @Test
-    public void shouldPutAttributesIntoHeadersWhenMappingDefined() throws 
MessagingException {
+    void shouldPutAttributesIntoHeadersWhenMappingDefined() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("simplemapping",
@@ -179,7 +174,7 @@ public class MailAttributesListToMimeHeadersTest {
     }
 
     @Test
-    public void 
shouldNotRemovePreviousAttributeValueWhenAttributeAlreadyPresent() throws 
MessagingException {
+    void shouldNotRemovePreviousAttributeValueWhenAttributeAlreadyPresent() 
throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("simplemapping", MAIL_ATTRIBUTE_NAME1 + "; " + 
HEADER_NAME1)
@@ -200,7 +195,7 @@ public class MailAttributesListToMimeHeadersTest {
     }
 
     @Test
-    public void shouldFilterAttributeOfWrongClass() throws MessagingException {
+    void shouldFilterAttributeOfWrongClass() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("simplemapping",
@@ -224,7 +219,7 @@ public class MailAttributesListToMimeHeadersTest {
 
 
     @Test
-    public void shouldFilterAttributeElementsOfWrongClass() throws 
MessagingException {
+    void shouldFilterAttributeElementsOfWrongClass() throws MessagingException 
{
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("simplemapping", MAIL_ATTRIBUTE_NAME1 + "; " + 
HEADER_NAME1)
@@ -244,37 +239,34 @@ public class MailAttributesListToMimeHeadersTest {
 
 
     @Test
-    public void shouldThrowAtInitWhenNoSemicolumnInConfigurationEntry() throws 
MessagingException {
-        expectedException.expect(IllegalArgumentException.class);
-
+    void shouldThrowAtInitWhenNoSemicolumnInConfigurationEntry() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("simplemapping", "invalidConfigEntry")
                 .build();
 
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> mailet.init(mailetConfig))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void shouldThrowAtInitWhenTwoSemicolumnsInConfigurationEntry() 
throws MessagingException {
-        expectedException.expect(IllegalArgumentException.class);
-
+    void shouldThrowAtInitWhenTwoSemicolumnsInConfigurationEntry() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("simplemapping", "first;second;third")
                 .build();
 
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> mailet.init(mailetConfig))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void shouldThrowAtInitWhenNoConfigurationEntry() throws 
MessagingException {
-        expectedException.expect(MessagingException.class);
-
+    void shouldThrowAtInitWhenNoConfigurationEntry() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .build();
 
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> mailet.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesToMimeHeadersTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesToMimeHeadersTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesToMimeHeadersTest.java
index b02fedf..3b9e845 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesToMimeHeadersTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MailAttributesToMimeHeadersTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import javax.mail.MessagingException;
 
@@ -28,15 +29,11 @@ import org.apache.mailet.Mailet;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
 import org.apache.mailet.base.test.MailUtil;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class MailAttributesToMimeHeadersTest {
+class MailAttributesToMimeHeadersTest {
 
-    @Rule public ExpectedException expectedException = 
ExpectedException.none();
-    
     private Mailet mailet;
 
     private static final String HEADER_NAME1 = "JUNIT";
@@ -48,34 +45,34 @@ public class MailAttributesToMimeHeadersTest {
     private static final String MAIL_ATTRIBUTE_NAME1 = "org.apache.james.test";
     private static final String MAIL_ATTRIBUTE_NAME2 = 
"org.apache.james.test2";
 
-    @Before
-    public void setup() {
+    @BeforeEach
+    void setup() {
         mailet = new MailAttributesToMimeHeaders();
     }
 
     @Test
-    public void shouldThrowMessagingExceptionIfMappingIsNotGiven() throws 
MessagingException {
-        expectedException.expect(MessagingException.class);
+    void shouldThrowMessagingExceptionIfMappingIsNotGiven() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .build();
 
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> mailet.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void shouldThrowMessagingExceptionIfMappingIsEmpty() throws 
MessagingException {
-        expectedException.expect(MessagingException.class);
+    void shouldThrowMessagingExceptionIfMappingIsEmpty() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("simplemmapping", "")
             .build();
 
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> mailet.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void shouldIgnoreAttributeOfMappingThatDoesNotExistOnTheMessage() 
throws MessagingException {
+    void shouldIgnoreAttributeOfMappingThatDoesNotExistOnTheMessage() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("simplemapping",
@@ -95,7 +92,7 @@ public class MailAttributesToMimeHeadersTest {
     }
 
     @Test
-    public void shouldWorkWithMappingWithASingleBinding() throws 
MessagingException {
+    void shouldWorkWithMappingWithASingleBinding() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("simplemapping",
@@ -112,7 +109,7 @@ public class MailAttributesToMimeHeadersTest {
     }
 
     @Test
-    public void shouldPutAttributesIntoHeadersWhenMappingDefined() throws 
MessagingException {
+    void shouldPutAttributesIntoHeadersWhenMappingDefined() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("simplemapping", 
@@ -134,7 +131,7 @@ public class MailAttributesToMimeHeadersTest {
     }
 
     @Test
-    public void shouldAddAttributeIntoHeadersWhenHeaderAlreadyPresent() throws 
MessagingException {
+    void shouldAddAttributeIntoHeadersWhenHeaderAlreadyPresent() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("simplemapping", MAIL_ATTRIBUTE_NAME1 + "; " + 
HEADER_NAME1)
@@ -153,31 +150,31 @@ public class MailAttributesToMimeHeadersTest {
 
     
     @Test
-    public void shouldThrowAtInitWhenNoSemicolumnInConfigurationEntry() throws 
MessagingException {
+    void shouldThrowAtInitWhenNoSemicolumnInConfigurationEntry() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("simplemapping", "invalidConfigEntry")
                 .build();
-        expectedException.expect(IllegalArgumentException.class);
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> mailet.init(mailetConfig))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void shouldThrowAtInitWhenTwoSemicolumnsInConfigurationEntry() 
throws MessagingException {
+    void shouldThrowAtInitWhenTwoSemicolumnsInConfigurationEntry() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("simplemapping", "first;second;third")
                 .build();
-        expectedException.expect(IllegalArgumentException.class);
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> mailet.init(mailetConfig))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void shouldThrowAtInitWhenNoConfigurationEntry() throws 
MessagingException {
+    void shouldThrowAtInitWhenNoConfigurationEntry() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .build();
-        expectedException.expect(MessagingException.class);
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> mailet.init(mailetConfig))
+            .isInstanceOf(MessagingException.class);
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/MappingArgumentTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/MappingArgumentTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MappingArgumentTest.java
index 4199b4a..19faac6 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/MappingArgumentTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MappingArgumentTest.java
@@ -20,75 +20,71 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import javax.mail.MessagingException;
 
 import org.assertj.core.data.MapEntry;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
-public class MappingArgumentTest {
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
+class MappingArgumentTest {
 
     @Test
-    public void parseShouldFailIfCalledWithNull() throws MessagingException {
-        expectedException.expect(IllegalArgumentException.class);
-        MappingArgument.parse(null);
+    void parseShouldFailIfCalledWithNull() {
+        assertThatThrownBy(() -> MappingArgument.parse(null))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void parseShouldFailIfCalledWhenMissingMappingParts() throws 
MessagingException {
-        expectedException.expect(IllegalArgumentException.class);
-        MappingArgument.parse("key1;value1,key2");
+    void parseShouldFailIfCalledWhenMissingMappingParts() {
+        assertThatThrownBy(() -> MappingArgument.parse("key1;value1,key2"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void parseShouldFailIfCalledWhenExtraMappingParts() throws 
MessagingException {
-        expectedException.expect(IllegalArgumentException.class);
-        MappingArgument.parse("key1;value1,key2;value1;value3");
+    void parseShouldFailIfCalledWhenExtraMappingParts() {
+        assertThatThrownBy(() -> 
MappingArgument.parse("key1;value1,key2;value1;value3"))
+           .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void parseShouldWorkForEmptyMapping() throws MessagingException {
+    void parseShouldWorkForEmptyMapping() throws MessagingException {
         assertThat(MappingArgument.parse(""))
             .isEmpty();
     }
 
     @Test
-    public void parseShouldWorkForEmptyMappingWithSpace() throws 
MessagingException {
+    void parseShouldWorkForEmptyMappingWithSpace() throws MessagingException {
         assertThat(MappingArgument.parse("  "))
             .isEmpty();
     }
 
     @Test
-    public void parseShouldWorkForValidParsingWithOnlyOneKey() throws 
MessagingException {
+    void parseShouldWorkForValidParsingWithOnlyOneKey() throws 
MessagingException {
         assertThat(MappingArgument.parse("key1;value1"))
             .containsExactly(MapEntry.entry("key1", "value1"));
     }
 
     @Test
-    public void parseShouldWorkForValidParsingWithMoreThanOneKey() throws 
MessagingException {
+    void parseShouldWorkForValidParsingWithMoreThanOneKey() throws 
MessagingException {
         assertThat(MappingArgument.parse("key1;value1,key2;value2"))
             .containsExactly(MapEntry.entry("key1", "value1"), 
MapEntry.entry("key2", "value2"));
     }
 
     @Test
-    public void parserShouldTrimSpacesAroundSemiColon() throws 
MessagingException {
+    void parserShouldTrimSpacesAroundSemiColon() throws MessagingException {
         assertThat(MappingArgument.parse("key1;    value1"))
             .containsExactly(MapEntry.entry("key1", "value1"));
     }
 
     @Test
-    public void parserShouldTrimSpacesAroundComa() throws MessagingException {
+    void parserShouldTrimSpacesAroundComa() throws MessagingException {
         assertThat(MappingArgument.parse("key1;value1,  key2;value2"))
             .containsExactly(MapEntry.entry("key1", "value1"), 
MapEntry.entry("key2", "value2"));
     }
 
     @Test
-    public void parserShouldNotFailWhenExtraComa() throws MessagingException {
+    void parserShouldNotFailWhenExtraComa() throws MessagingException {
         assertThat(MappingArgument.parse("key1;value1,"))
             .containsExactly(MapEntry.entry("key1", "value1"));
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/MimeDecodingMailetTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/MimeDecodingMailetTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MimeDecodingMailetTest.java
index c8d1a7e..dc62744 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/MimeDecodingMailetTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/MimeDecodingMailetTest.java
@@ -19,6 +19,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 
 import java.nio.charset.StandardCharsets;
@@ -32,58 +33,52 @@ import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
 import org.assertj.core.data.MapEntry;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 
-public class MimeDecodingMailetTest {
+class MimeDecodingMailetTest {
 
     private static final String MAIL_ATTRIBUTE = "mime.attachments";
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
-    private Logger logger;
     private MailetContext mailetContext;
     private MimeDecodingMailet testee;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() {
         testee = new MimeDecodingMailet();
-        logger = mock(Logger.class);
+        Logger logger = mock(Logger.class);
         mailetContext = FakeMailContext.builder()
                 .logger(logger)
                 .build();
     }
 
     @Test
-    public void initShouldThrowWhenNoAttributeParameter() throws 
MessagingException {
+    void initShouldThrowWhenNoAttributeParameter() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .mailetContext(mailetContext)
                 .build();
-        expectedException.expect(MailetException.class);
-        testee.init(mailetConfig);
+        assertThatThrownBy(() -> testee.init(mailetConfig))
+            .isInstanceOf(MailetException.class);
     }
 
     @Test
-    public void initShouldThrowWhenAttributeParameterIsEmpty() throws 
MessagingException {
+    void initShouldThrowWhenAttributeParameterIsEmpty() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .mailetContext(mailetContext)
                 .setProperty(MimeDecodingMailet.ATTRIBUTE_PARAMETER_NAME, "")
                 .build();
-        expectedException.expect(MailetException.class);
-        testee.init(mailetConfig);
+        assertThatThrownBy(() -> testee.init(mailetConfig))
+            .isInstanceOf(MailetException.class);
     }
 
     @Test
-    public void serviceShouldNotThrowWhenAttributeContentIsNotAMap() throws 
MessagingException {
+    void serviceShouldNotThrowWhenAttributeContentIsNotAMap() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .mailetContext(mailetContext)
@@ -98,7 +93,7 @@ public class MimeDecodingMailetTest {
     }
 
     @Test
-    public void serviceShouldNotThrowWhenAttributeContentIsAMapOfWrongTypes() 
throws MessagingException {
+    void serviceShouldNotThrowWhenAttributeContentIsAMapOfWrongTypes() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .mailetContext(mailetContext)
@@ -113,7 +108,7 @@ public class MimeDecodingMailetTest {
     }
 
     @Test
-    public void serviceShouldNotSetAttributeWhenNone() throws 
MessagingException {
+    void serviceShouldNotSetAttributeWhenNone() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .mailetContext(mailetContext)
@@ -129,7 +124,7 @@ public class MimeDecodingMailetTest {
 
     @Test
     @SuppressWarnings("unchecked")
-    public void serviceShouldChangeAttributeWhenDefined() throws 
MessagingException {
+    void serviceShouldChangeAttributeWhenDefined() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .mailetContext(mailetContext)

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/NullTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/NullTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/NullTest.java
index 9bd6ec6..270000d 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/NullTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/NullTest.java
@@ -26,14 +26,14 @@ import javax.mail.MessagingException;
 
 import org.apache.mailet.Mailet;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class NullTest {
 
     private Mailet mailet;
 
-    @Before
+    @BeforeEach
     public void setup() {
         mailet = new Null();
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/OnlyTextTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/OnlyTextTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/OnlyTextTest.java
index 4ce817f..16c7325 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/OnlyTextTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/OnlyTextTest.java
@@ -19,6 +19,9 @@
 
 package org.apache.james.transport.mailets;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 import java.io.IOException;
 import java.util.Properties;
 
@@ -32,10 +35,9 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.Mailet;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
+import org.junit.jupiter.api.Test;
 
-import junit.framework.TestCase;
-
-public class OnlyTextTest extends TestCase {
+class OnlyTextTest {
 
     /**
      * Test method for
@@ -45,7 +47,8 @@ public class OnlyTextTest extends TestCase {
      * @throws MessagingException
      * @throws IOException
      */
-    public void testService() throws MessagingException, IOException {
+    @Test
+    void testService() throws MessagingException, IOException {
         Mailet mailet;
         FakeMailetConfig mci;
         MimeMessage message;
@@ -177,7 +180,8 @@ public class OnlyTextTest extends TestCase {
         assertTrue(mail.getMessage().isMimeType("text/plain"));
     }
 
-    public void testHtml2Text() throws MessagingException {
+    @Test
+    void testHtml2Text() throws MessagingException {
         OnlyText mailet = new OnlyText();
         mailet.init(FakeMailetConfig.builder()
                 .mailetName("Test")

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/PatternExtractorTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/PatternExtractorTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/PatternExtractorTest.java
index 72ab701..d502b40 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/PatternExtractorTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/PatternExtractorTest.java
@@ -20,30 +20,26 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.List;
 import java.util.regex.Pattern;
 
 import org.apache.mailet.MailetException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class PatternExtractorTest {
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
+class PatternExtractorTest {
 
     private PatternExtractor testee;
 
-    @Before
-    public void setup() {
+    @BeforeEach
+    void setup() {
         testee = new PatternExtractor();
     }
 
     @Test
-    public void getPatternsFromStringShouldReturnValuesWhenMultiplePatterns() 
throws Exception {
+    void getPatternsFromStringShouldReturnValuesWhenMultiplePatterns() throws 
Exception {
         List<ReplacingPattern> patternsFromString = 
testee.getPatternsFromString("/test/TEST/i/,/a/e//,/o/o/ir/");
 
         assertThat(patternsFromString).containsOnly(
@@ -53,7 +49,7 @@ public class PatternExtractorTest {
     }
 
     @Test
-    public void 
getPatternsFromFileListShouldReturnValuesWhenMultiplePatterns() throws 
Exception {
+    void getPatternsFromFileListShouldReturnValuesWhenMultiplePatterns() 
throws Exception {
         List<ReplacingPattern> patternsFromFileList = 
testee.getPatternsFromFileList("#/org/apache/james/mailet/standard/mailets/replaceSubject.patterns");
 
         assertThat(patternsFromFileList).containsOnly(
@@ -63,40 +59,34 @@ public class PatternExtractorTest {
     }
 
     @Test
-    public void 
getPatternsFromStringShouldThrowWhenPatternIsLessThanTwoCharacters() throws 
Exception {
-        expectedException.expect(MailetException.class);
-
-        testee.getPatternsFromString("a");
+    void getPatternsFromStringShouldThrowWhenPatternIsLessThanTwoCharacters() {
+        assertThatThrownBy(() -> 
testee.getPatternsFromString("a")).isInstanceOf(MailetException.class);
     }
 
     @Test
-    public void 
getPatternsFromStringShouldThrowWhenPatternDoesNotStartWithSlash() throws 
Exception {
-        expectedException.expect(MailetException.class);
-
-        testee.getPatternsFromString("abc/");
+    void getPatternsFromStringShouldThrowWhenPatternDoesNotStartWithSlash() {
+        assertThatThrownBy(() -> 
testee.getPatternsFromString("abc/")).isInstanceOf(MailetException.class);
     }
 
     @Test
-    public void 
getPatternsFromStringShouldThrowWhenPatternDoesNotEndWithSlash() throws 
Exception {
-        expectedException.expect(MailetException.class);
-
-        testee.getPatternsFromString("/abc");
+    void getPatternsFromStringShouldThrowWhenPatternDoesNotEndWithSlash() {
+        assertThatThrownBy(() -> 
testee.getPatternsFromString("/abc")).isInstanceOf(MailetException.class);
     }
 
     @Test
-    public void serviceShouldUnescapeCarriageReturn() throws Exception {
+    void serviceShouldUnescapeCarriageReturn() throws Exception {
         List<ReplacingPattern> patternsFromString = 
testee.getPatternsFromString("/a/\\\\r/i/");
         assertThat(patternsFromString).containsOnly(new 
ReplacingPattern(Pattern.compile("a"), false, "\\\r"));
     }
 
     @Test
-    public void serviceShouldUnescapeLineBreak() throws Exception {
+    void serviceShouldUnescapeLineBreak() throws Exception {
         List<ReplacingPattern> patternsFromString = 
testee.getPatternsFromString("/a/\\\\n/i/");
         assertThat(patternsFromString).containsOnly(new 
ReplacingPattern(Pattern.compile("a"), false, "\\\n"));
     }
 
     @Test
-    public void serviceShouldUnescapeTabReturn() throws Exception {
+    void serviceShouldUnescapeTabReturn() throws Exception {
         List<ReplacingPattern> patternsFromString = 
testee.getPatternsFromString("/a/\\\\t/i/");
         assertThat(patternsFromString).containsOnly(new 
ReplacingPattern(Pattern.compile("a"), false, "\\\t"));
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/PostmasterAliasTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/PostmasterAliasTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/PostmasterAliasTest.java
index f485158..56ac5a1 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/PostmasterAliasTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/PostmasterAliasTest.java
@@ -27,15 +27,15 @@ import org.apache.mailet.base.MailAddressFixture;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailContext;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class PostmasterAliasTest {
     private PostmasterAlias testee;
     private MailAddress postmaster;
     private MailAddress postmasterAlias;
 
-    @Before
+    @BeforeEach
     public void setUp() throws Exception {
         postmaster = new MailAddress("admin@localhost");
         postmasterAlias = new MailAddress("postmaster@localhost");

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/RecipientToLowerCaseTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RecipientToLowerCaseTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RecipientToLowerCaseTest.java
index 49762c6..f59761f 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RecipientToLowerCaseTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RecipientToLowerCaseTest.java
@@ -25,14 +25,14 @@ import java.util.Collection;
 
 import org.apache.james.core.MailAddress;
 import org.apache.mailet.base.test.FakeMail;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class RecipientToLowerCaseTest {
 
     private RecipientToLowerCase testee;
 
-    @Before
+    @BeforeEach
     public void setUp() {
         testee = new RecipientToLowerCase();
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveAllMailAttributesTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveAllMailAttributesTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveAllMailAttributesTest.java
index 7f2c0e3..0dba54c 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveAllMailAttributesTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveAllMailAttributesTest.java
@@ -28,15 +28,15 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.Mailet;
 import org.apache.mailet.base.test.FakeMailetConfig;
 import org.apache.mailet.base.test.MailUtil;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class RemoveAllMailAttributesTest {
 
     private Mail mail;
     private Mailet mailet;
 
-    @Before
+    @BeforeEach
     public void setUp() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMailAttributeTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMailAttributeTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMailAttributeTest.java
index fd9bb39..1881dd3 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMailAttributeTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMailAttributeTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import javax.mail.MessagingException;
 
@@ -28,10 +29,10 @@ import org.apache.mailet.Mailet;
 import org.apache.mailet.MailetException;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class RemoveMailAttributeTest {
+class RemoveMailAttributeTest {
 
     private static final String ATTRIBUTE_1 = "attribute1";
     private static final String ATTRIBUTE_2 = "attribute2";
@@ -42,31 +43,31 @@ public class RemoveMailAttributeTest {
     private static final String ATTRIBUTE1_ATTRIBUTE2 = "attribute1, 
attribute2";
     private Mailet removeMailet;
 
-    @Before
-    public void setup() throws Exception {
+    @BeforeEach
+    void setup() {
         removeMailet = new RemoveMailAttribute();
     }
 
     @Test
-    public void getMailetInfoShouldReturnCorrectInformation() throws Exception 
{
+    void getMailetInfoShouldReturnCorrectInformation() {
         assertThat(removeMailet.getMailetInfo()).isEqualTo("Remove Mail 
Attribute Mailet");
     }
 
-    @Test(expected = MailetException.class)
-    public void 
initShouldThrowExceptionIfMailetConfigDoesNotContainAttribute() throws 
MessagingException {
+    @Test
+    void initShouldThrowExceptionIfMailetConfigDoesNotContainAttribute() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .build();
-        removeMailet.init(mailetConfig);
+        assertThatThrownBy(() -> 
removeMailet.init(mailetConfig)).isInstanceOf(MailetException.class);
     }
 
-    @Test(expected = NullPointerException.class)
-    public void serviceShouldThrowExceptionWithMailNull() throws 
MessagingException {
-        removeMailet.service(null);
+    @Test
+    void serviceShouldThrowExceptionWithMailNull() {
+        assertThatThrownBy(() -> 
removeMailet.service(null)).isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void serviceShouldDoNothingWhenMailHasEmptyAttribute() throws 
MessagingException {
+    void serviceShouldDoNothingWhenMailHasEmptyAttribute() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty(RemoveMailAttribute.MAILET_NAME_PARAMETER, 
ATTRIBUTE1_ATTRIBUTE2)
@@ -80,7 +81,7 @@ public class RemoveMailAttributeTest {
     }
 
     @Test
-    public void serviceShouldDoNothingWhenMailDoNotMatchAttribute() throws 
MessagingException {
+    void serviceShouldDoNothingWhenMailDoNotMatchAttribute() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty(RemoveMailAttribute.MAILET_NAME_PARAMETER, 
ATTRIBUTE1_ATTRIBUTE2)
@@ -96,7 +97,7 @@ public class RemoveMailAttributeTest {
     }
 
     @Test
-    public void serviceShouldRemoveSpecifiedAttribute() throws 
MessagingException {
+    void serviceShouldRemoveSpecifiedAttribute() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty(RemoveMailAttribute.MAILET_NAME_PARAMETER, 
ATTRIBUTE_1)
@@ -114,7 +115,7 @@ public class RemoveMailAttributeTest {
     }
 
     @Test
-    public void serviceShouldRemoveSpecifiedAttributes() throws 
MessagingException {
+    void serviceShouldRemoveSpecifiedAttributes() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty(RemoveMailAttribute.MAILET_NAME_PARAMETER, 
ATTRIBUTE1_ATTRIBUTE2)

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderByPrefixTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderByPrefixTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderByPrefixTest.java
index 5008d8e..51143c4 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderByPrefixTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderByPrefixTest.java
@@ -20,6 +20,7 @@
 package org.apache.james.transport.mailets;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import javax.mail.MessagingException;
 
@@ -29,35 +30,30 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class RemoveMimeHeaderByPrefixTest {
+class RemoveMimeHeaderByPrefixTest {
 
     private static final String PREFIX = "X-OPENPAAS-";
     private static final String HEADER_NAME_PREFIX_1 = "X-OPENPAAS-FEATURE-A";
     private static final String HEADER_NAME_PREFIX_2 = "X-OPENPAAS-FEATURE-B";
     private static final String HEADER_NAME_NO_PREFIX = "X-OTHER-BUSINESS";
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private GenericMailet mailet;
 
-    @Before
-    public void setup() {
+    @BeforeEach
+    void setup() {
         mailet = new RemoveMimeHeaderByPrefix();
     }
 
     @Test
-    public void getMailetInfoShouldReturnValue() {
+    void getMailetInfoShouldReturnValue() {
         assertThat(mailet.getMailetInfo()).isEqualTo("RemoveMimeHeaderByPrefix 
Mailet");
     }
 
     @Test
-    public void serviceShouldRemoveHeaderWhenPrefixed() throws 
MessagingException {
+    void serviceShouldRemoveHeaderWhenPrefixed() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("prefix", PREFIX)
@@ -75,7 +71,7 @@ public class RemoveMimeHeaderByPrefixTest {
     }
 
     @Test
-    public void serviceShouldRemoveAllPrefixedHeaders() throws 
MessagingException {
+    void serviceShouldRemoveAllPrefixedHeaders() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("prefix", PREFIX)
@@ -94,7 +90,7 @@ public class RemoveMimeHeaderByPrefixTest {
     }
 
     @Test
-    public void serviceShouldNotRemoveNonPrefixedHeaders() throws 
MessagingException {
+    void serviceShouldNotRemoveNonPrefixedHeaders() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("prefix", PREFIX)
@@ -114,7 +110,7 @@ public class RemoveMimeHeaderByPrefixTest {
     }
 
     @Test
-    public void exactMatchOfPrefixShouldBeAllowed() throws MessagingException {
+    void exactMatchOfPrefixShouldBeAllowed() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty("prefix", PREFIX)
@@ -135,21 +131,19 @@ public class RemoveMimeHeaderByPrefixTest {
 
 
     @Test
-    public void initShouldThrowWhenInvalidConfig() throws MessagingException {
-        expectedException.expect(MessagingException.class);
+    void initShouldThrowWhenInvalidConfig() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .build();
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> 
mailet.init(mailetConfig)).isInstanceOf(MessagingException.class);
     }
 
     @Test
-    public void initShouldThrowWhenPrefixEmpty() throws MessagingException {
-        expectedException.expect(MessagingException.class);
+    void initShouldThrowWhenPrefixEmpty() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
             .mailetName("Test")
             .setProperty(RemoveMimeHeaderByPrefix.PREFIX, "")
             .build();
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> 
mailet.init(mailetConfig)).isInstanceOf(MessagingException.class);
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderTest.java
index cfce358..7e97007 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/RemoveMimeHeaderTest.java
@@ -32,33 +32,28 @@ import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class RemoveMimeHeaderTest {
+class RemoveMimeHeaderTest {
 
     private static final String HEADER1 = "header1";
     private static final String HEADER2 = "header2";
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private GenericMailet mailet;
 
-    @Before
-    public void setup() {
+    @BeforeEach
+    void setup() {
         mailet = new RemoveMimeHeader();
     }
 
     @Test
-    public void getMailetInfoShouldReturnValue() {
+    void getMailetInfoShouldReturnValue() {
         assertThat(mailet.getMailetInfo()).isEqualTo("RemoveMimeHeader 
Mailet");
     }
 
     @Test
-    public void serviceShouldRemoveHeaderWhenOneMatching() throws 
MessagingException {
+    void serviceShouldRemoveHeaderWhenOneMatching() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("name", HEADER1)
@@ -76,7 +71,7 @@ public class RemoveMimeHeaderTest {
     }
 
     @Test
-    public void serviceShouldRemoveHeadersWhenTwoMatching() throws 
MessagingException {
+    void serviceShouldRemoveHeadersWhenTwoMatching() throws MessagingException 
{
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("name", HEADER1 + "," + HEADER2)
@@ -94,7 +89,7 @@ public class RemoveMimeHeaderTest {
     }
 
     @Test
-    public void serviceShouldNotRemoveHeaderWhenNoneMatching() throws 
MessagingException {
+    void serviceShouldNotRemoveHeaderWhenNoneMatching() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("name", "other1")
@@ -113,7 +108,7 @@ public class RemoveMimeHeaderTest {
     }
 
     @Test
-    public void serviceShouldNotRemoveHeaderWhenEmptyConfig() throws 
MessagingException {
+    void serviceShouldNotRemoveHeaderWhenEmptyConfig() throws 
MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("name", "")
@@ -131,17 +126,16 @@ public class RemoveMimeHeaderTest {
     }
 
     @Test
-    public void initShouldThrowWhenInvalidConfig() throws MessagingException {
-        expectedException.expect(MessagingException.class);
+    void initShouldThrowWhenInvalidConfig() {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .build();
-        mailet.init(mailetConfig);
+        assertThatThrownBy(() -> 
mailet.init(mailetConfig)).isInstanceOf(MessagingException.class);
     }
 
     @SuppressWarnings("unchecked")
     @Test
-    public void serviceShouldThrowWhenExceptionOccured() throws 
MessagingException {
+    void serviceShouldThrowWhenExceptionOccured() throws MessagingException {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("name", "")

http://git-wip-us.apache.org/repos/asf/james-project/blob/1e365b3e/mailet/standard/src/test/java/org/apache/james/transport/mailets/ReplaceContentTest.java
----------------------------------------------------------------------
diff --git 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/ReplaceContentTest.java
 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/ReplaceContentTest.java
index cb9d9db..508c4c1 100644
--- 
a/mailet/standard/src/test/java/org/apache/james/transport/mailets/ReplaceContentTest.java
+++ 
b/mailet/standard/src/test/java/org/apache/james/transport/mailets/ReplaceContentTest.java
@@ -30,30 +30,25 @@ import org.apache.james.util.MimeMessageUtil;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.test.FakeMail;
 import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 public class ReplaceContentTest {
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     private ReplaceContent mailet;
 
-    @Before
-    public void setup() {
+    @BeforeEach
+    void setup() {
         mailet = new ReplaceContent();
     }
 
     @Test
-    public void getMailetInfoShouldReturnValue() {
+    void getMailetInfoShouldReturnValue() {
         assertThat(mailet.getMailetInfo()).isEqualTo("ReplaceContent");
     }
 
     @Test
-    public void serviceShouldReplaceSubjectWhenMatching() throws Exception {
+    void serviceShouldReplaceSubjectWhenMatching() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("subjectPattern", "/test/TEST/i/,/o/a//,/s/s/i/")
@@ -70,7 +65,7 @@ public class ReplaceContentTest {
     }
 
     @Test
-    public void serviceShouldReplaceBodyWhenMatching() throws Exception {
+    void serviceShouldReplaceBodyWhenMatching() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("bodyPattern", 
@@ -95,7 +90,7 @@ public class ReplaceContentTest {
     }
 
     @Test
-    public void serviceShouldNotLoopWhenCaseInsensitiveAndRepeat() throws 
Exception {
+    void serviceShouldNotLoopWhenCaseInsensitiveAndRepeat() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("bodyPattern", "/a/a/ir/")
@@ -112,7 +107,7 @@ public class ReplaceContentTest {
     }
 
     @Test
-    public void serviceShouldReplaceSubjectWhenConfigurationFromFile() throws 
Exception {
+    void serviceShouldReplaceSubjectWhenConfigurationFromFile() throws 
Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("subjectPatternFile", 
"#/org/apache/james/mailet/standard/mailets/replaceSubject.patterns")
@@ -129,7 +124,7 @@ public class ReplaceContentTest {
     }
 
     @Test
-    public void serviceShouldRemoveOrAddTextInBody() throws Exception {
+    void serviceShouldRemoveOrAddTextInBody() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("bodyPattern", "/--original message--/<quote>/i/,"
@@ -153,7 +148,7 @@ public class ReplaceContentTest {
 
 
     @Test
-    public void serviceShouldReplaceBodyWhenMatchingASCIICharacter() throws 
Exception {
+    void serviceShouldReplaceBodyWhenMatchingASCIICharacter() throws Exception 
{
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("bodyPattern", "/\\u2026/.../r/")
@@ -171,7 +166,7 @@ public class ReplaceContentTest {
     }
 
     @Test
-    public void serviceShouldReplaceBodyWhenMatchingCharset() throws Exception 
{
+    void serviceShouldReplaceBodyWhenMatchingCharset() throws Exception {
         String messageSource = "Content-Type: text/plain; 
charset=\"iso-8859-1\"\r\n"
                 + "Content-Transfer-Encoding: quoted-printable\r\n"
                 + "\r\n"
@@ -197,7 +192,7 @@ public class ReplaceContentTest {
     }
 
     @Test
-    public void serviceShouldSetContenTypeWhenInitialized() throws Exception {
+    void serviceShouldSetContenTypeWhenInitialized() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("Test")
                 .setProperty("subjectPattern", "/test/TEST/i/,/o/a//,/s/s/i/")


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

Reply via email to