You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ro...@apache.org on 2018/12/18 12:57:27 UTC

[2/7] james-project git commit: JAMES-2611 Migrate james-server-util to JUNIT5

JAMES-2611 Migrate james-server-util to JUNIT5


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

Branch: refs/heads/master
Commit: c0b5811650f7cd92857fdd960227992370d78071
Parents: e11a3a7
Author: Gautier DI FOLCO <gd...@linagora.com>
Authored: Wed Nov 28 11:31:08 2018 +0100
Committer: Raphael Ouazana <ra...@linagora.com>
Committed: Tue Dec 18 13:56:45 2018 +0100

----------------------------------------------------------------------
 .../james/util/BodyOffsetInputStreamTest.java   |  22 ++-
 .../james/util/CommutativityCheckerTest.java    |  20 +--
 .../james/util/CompletableFutureUtilTest.java   |  64 +++----
 .../james/util/FluentFutureStreamTest.java      |  46 ++---
 .../org/apache/james/util/GuavaUtilsTest.java   |  12 +-
 .../java/org/apache/james/util/HostTest.java    | 119 +++++--------
 .../apache/james/util/IteratorWrapperTest.java  |  23 +--
 .../org/apache/james/util/MDCBuilderTest.java   |  40 ++---
 .../apache/james/util/OptionalUtilsTest.java    |  69 ++++----
 .../java/org/apache/james/util/PortTest.java    |  26 +--
 .../org/apache/james/util/SizeFormatTest.java   |  24 +--
 .../java/org/apache/james/util/SizeTest.java    |  31 ++--
 .../org/apache/james/util/StreamUtilsTest.java  |  24 +--
 .../apache/james/util/TimeConverterTest.java    | 172 ++++++++++---------
 .../org/apache/james/util/ValuePatchTest.java   |  70 ++++----
 .../concurrency/ConcurrentTestRunnerTest.java   |  30 ++--
 .../util/date/ImapDateTimeFormatterTest.java    | 161 +++++++++--------
 .../util/mime/MessageContentExtractorTest.java  |  64 +++----
 .../util/retry/DoublingRetryScheduleTest.java   |  76 ++++----
 .../util/retry/ExceptionRetryHandlerTest.java   |  18 +-
 .../james/util/retry/RetryExecutorUtilTest.java |  26 +--
 .../naming/NamingExceptionRetryHandlerTest.java |  20 +--
 .../util/streams/ImmutableCollectorsTest.java   |  30 ++--
 .../james/util/streams/IteratorsTest.java       |   6 +-
 .../james/util/streams/JamesCollectorsTest.java |  34 ++--
 .../apache/james/util/streams/LimitTest.java    |  38 ++--
 .../apache/james/util/streams/OffsetTest.java   |  12 +-
 27 files changed, 600 insertions(+), 677 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/BodyOffsetInputStreamTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/BodyOffsetInputStreamTest.java b/server/container/util/src/test/java/org/apache/james/util/BodyOffsetInputStreamTest.java
index 5826c7f..cf3a09e 100644
--- a/server/container/util/src/test/java/org/apache/james/util/BodyOffsetInputStreamTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/BodyOffsetInputStreamTest.java
@@ -23,17 +23,17 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class BodyOffsetInputStreamTest {
     private String mail = "Subject: test\r\n\r\nbody";
     private long expectedOffset = 17;
     private long bytes = mail.length();
-    
+
     @Test
-    public void testRead() throws IOException {
+    void testRead() throws IOException {
         BodyOffsetInputStream in = new BodyOffsetInputStream(new ByteArrayInputStream(mail.getBytes()));
-        
+
         while (in.read() != -1) {
             // consume stream
         }
@@ -41,12 +41,11 @@ public class BodyOffsetInputStreamTest {
         assertThat(in.getReadBytes()).isEqualTo(bytes);
         in.close();
     }
-    
-    
+
     @Test
-    public void testReadWithArray() throws IOException {
+    void testReadWithArray() throws IOException {
         BodyOffsetInputStream in = new BodyOffsetInputStream(new ByteArrayInputStream(mail.getBytes()));
-        
+
         byte[] b = new byte[8];
         while (in.read(b) != -1) {
             // consume stream
@@ -55,12 +54,11 @@ public class BodyOffsetInputStreamTest {
         assertThat(in.getReadBytes()).isEqualTo(bytes);
         in.close();
     }
-    
-    
+
     @Test
-    public void testReadWithArrayBiggerThenStream() throws IOException {
+    void testReadWithArrayBiggerThenStream() throws IOException {
         BodyOffsetInputStream in = new BodyOffsetInputStream(new ByteArrayInputStream(mail.getBytes()));
-        
+
         byte[] b = new byte[4096];
         while (in.read(b) != -1) {
             // consume stream

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/CommutativityCheckerTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/CommutativityCheckerTest.java b/server/container/util/src/test/java/org/apache/james/util/CommutativityCheckerTest.java
index ec0802a..d0b9dac 100644
--- a/server/container/util/src/test/java/org/apache/james/util/CommutativityCheckerTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/CommutativityCheckerTest.java
@@ -26,13 +26,13 @@ import java.util.Set;
 import java.util.function.BinaryOperator;
 
 import org.apache.commons.lang3.tuple.Pair;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableSet;
 
 public class CommutativityCheckerTest {
     @Test
-    public void constructorShouldThrowWhenNullValuesToTest() throws Exception {
+    void constructorShouldThrowWhenNullValuesToTest() throws Exception {
         BinaryOperator<Integer> binaryOperator = (a, b) -> a * a + b;
 
         assertThatThrownBy(() -> new CommutativityChecker<>(null, binaryOperator))
@@ -40,7 +40,7 @@ public class CommutativityCheckerTest {
     }
 
     @Test
-    public void constructorShouldThrowWhenEmptyValuesToTest() throws Exception {
+    void constructorShouldThrowWhenEmptyValuesToTest() throws Exception {
         BinaryOperator<Integer> binaryOperator = (a, b) -> a * a + b;
 
         assertThatThrownBy(() -> new CommutativityChecker<>(ImmutableSet.of(), binaryOperator))
@@ -48,7 +48,7 @@ public class CommutativityCheckerTest {
     }
 
     @Test
-    public void constructorShouldThrowWhenSingleValueToTest() throws Exception {
+    void constructorShouldThrowWhenSingleValueToTest() throws Exception {
         BinaryOperator<Integer> binaryOperator = (a, b) -> a * a + b;
 
         assertThatThrownBy(() -> new CommutativityChecker<>(ImmutableSet.of(0), binaryOperator))
@@ -56,13 +56,13 @@ public class CommutativityCheckerTest {
     }
 
     @Test
-    public void constructorShouldThrowWhenNullOperation() throws Exception {
+    void constructorShouldThrowWhenNullOperation() throws Exception {
         assertThatThrownBy(() -> new CommutativityChecker<>(ImmutableSet.of(0, 1), null))
             .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void findNonCommutativeInputShouldReturnEmptyWhenCommutativeOperation() throws Exception {
+    void findNonCommutativeInputShouldReturnEmptyWhenCommutativeOperation() throws Exception {
         Set<Integer> integers = ImmutableSet.of(5, 4, 3, 2, 1);
         BinaryOperator<Integer> commutativeOperator = (a, b) -> a + b;
         CommutativityChecker<Integer> commutativityChecker = new CommutativityChecker<>(integers, commutativeOperator);
@@ -71,7 +71,7 @@ public class CommutativityCheckerTest {
     }
 
     @Test
-    public void findNonCommutativeInputShouldReturnDataWhenNonCommutativeOperation() throws Exception {
+    void findNonCommutativeInputShouldReturnDataWhenNonCommutativeOperation() throws Exception {
         Set<Integer> integers = ImmutableSet.of(2, 1);
         BinaryOperator<Integer> nonCommutativeOperator = (a, b) -> 2 * a + b;
         CommutativityChecker<Integer> commutativityChecker = new CommutativityChecker<>(integers, nonCommutativeOperator);
@@ -81,7 +81,7 @@ public class CommutativityCheckerTest {
     }
 
     @Test
-    public void findNonCommutativeInputShouldNotReturnStableValues() throws Exception {
+    void findNonCommutativeInputShouldNotReturnStableValues() throws Exception {
         Set<Integer> integers = ImmutableSet.of(0, 1, 2);
         BinaryOperator<Integer> nonCommutativeOperatorWithStableValues = (a, b) -> a * a + b;
         CommutativityChecker<Integer> commutativityChecker = new CommutativityChecker<>(integers, nonCommutativeOperatorWithStableValues);
@@ -92,11 +92,11 @@ public class CommutativityCheckerTest {
     }
 
     @Test
-    public void findNonCommutativeInputShouldReturnEmptyWhenNonCommutativeOperationButOnlyStableValues() throws Exception {
+    void findNonCommutativeInputShouldReturnEmptyWhenNonCommutativeOperationButOnlyStableValues() throws Exception {
         Set<Integer> stableValues = ImmutableSet.of(0, 1);
         BinaryOperator<Integer> nonCommutativeOperatorWithStableValues = (a, b) -> a * a + b;
         CommutativityChecker<Integer> commutativityChecker = new CommutativityChecker<>(stableValues, nonCommutativeOperatorWithStableValues);
 
         assertThat(commutativityChecker.findNonCommutativeInput()).isEmpty();
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java b/server/container/util/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
index cdfce5e..3b544e9 100644
--- a/server/container/util/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
@@ -34,29 +34,29 @@ import java.util.stream.IntStream;
 import java.util.stream.Stream;
 
 import org.apache.james.util.concurrent.NamedThreadFactory;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import com.github.steveash.guavate.Guavate;
 import com.google.common.collect.ImmutableList;
 
 public class CompletableFutureUtilTest {
-    private ExecutorService executorService;
+    private static ExecutorService executorService;
 
-    @Before
-    public void setUp() {
-        ThreadFactory threadFactory = NamedThreadFactory.withClassName(getClass());
+    @BeforeAll
+    static void setUp() {
+        ThreadFactory threadFactory = NamedThreadFactory.withClassName(CompletableFutureUtilTest.class);
         executorService = Executors.newFixedThreadPool(4, threadFactory);
     }
 
-    @After
-    public void tearDown() {
+    @AfterAll
+    static void tearDown() {
         executorService.shutdownNow();
     }
 
     @Test
-    public void allOfShouldUnboxEmptyStream() {
+    void allOfShouldUnboxEmptyStream() {
         assertThat(
             CompletableFutureUtil.allOf(Stream.empty())
                 .join()
@@ -65,7 +65,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void chainAllShouldPreserveExecutionOrder() {
+    void chainAllShouldPreserveExecutionOrder() {
         int itemCount = 10;
         ImmutableList<Integer> ints = IntStream.range(0, itemCount)
             .boxed()
@@ -90,7 +90,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void chainAllShouldNotThrowOnEmptyStream() {
+    void chainAllShouldNotThrowOnEmptyStream() {
         Stream<Integer> result = CompletableFutureUtil.chainAll(Stream.<Integer>of(),
             i -> CompletableFuture.supplyAsync(() -> i, executorService))
             .join();
@@ -100,7 +100,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void chainAllShouldPreserveOrder() {
+    void chainAllShouldPreserveOrder() {
         int itemCount = 10;
         ImmutableList<Integer> ints = IntStream.range(0, itemCount)
             .boxed()
@@ -115,7 +115,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void allOfShouldUnboxStream() {
+    void allOfShouldUnboxStream() {
         long value1 = 18L;
         long value2 = 19L;
         long value3 = 20L;
@@ -131,7 +131,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void allOfShouldSupportNullValue() {
+    void allOfShouldSupportNullValue() {
         assertThatCode(() ->
             CompletableFutureUtil.allOf(
                 Stream.of(
@@ -144,7 +144,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void allOfShouldPreserveOrder() {
+    void allOfShouldPreserveOrder() {
         long value1 = 18L;
         long value2 = 19L;
         long value3 = 20L;
@@ -174,7 +174,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void allOfShouldWorkOnVeryLargeStream() {
+    void allOfShouldWorkOnVeryLargeStream() {
         CompletableFutureUtil.allOf(
             IntStream.range(0, 100000)
                 .boxed()
@@ -183,7 +183,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void mapShouldMapOnStreamInsideACompletableFuturOfStream() {
+    void mapShouldMapOnStreamInsideACompletableFuturOfStream() {
         CompletableFuture<Stream<Integer>> futurOfInteger = CompletableFuture.completedFuture(Stream.of(1, 2, 3));
 
         assertThat(
@@ -195,7 +195,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void mapShouldReturnEmptyStreamWhenGivenAnEmptyStream() {
+    void mapShouldReturnEmptyStreamWhenGivenAnEmptyStream() {
         CompletableFuture<Stream<Integer>> futurOfInteger = CompletableFuture.completedFuture(Stream.of());
 
         assertThat(
@@ -207,7 +207,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void composeIfTrueShouldReturnTrueWhenTrue() {
+    void composeIfTrueShouldReturnTrueWhenTrue() {
         assertThat(
             CompletableFutureUtil.composeIfTrue(() -> CompletableFuture.completedFuture(null))
                 .apply(true)
@@ -216,7 +216,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void composeIfTrueShouldReturnFalseWhenFalse() {
+    void composeIfTrueShouldReturnFalseWhenFalse() {
         assertThat(
             CompletableFutureUtil.composeIfTrue(() -> CompletableFuture.completedFuture(null))
                 .apply(false)
@@ -225,7 +225,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void composeIfTrueShouldComposeWhenTrue() {
+    void composeIfTrueShouldComposeWhenTrue() {
         AtomicInteger atomicInteger = new AtomicInteger(0);
         CompletableFutureUtil.composeIfTrue(() -> {
             atomicInteger.incrementAndGet();
@@ -238,7 +238,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void composeIfTrueShouldNotComposeWhenFalse() {
+    void composeIfTrueShouldNotComposeWhenFalse() {
         AtomicInteger atomicInteger = new AtomicInteger(0);
         CompletableFutureUtil.composeIfTrue(() -> {
             atomicInteger.incrementAndGet();
@@ -251,7 +251,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void reduceShouldReturnEmptyWhenNoValue() {
+    void reduceShouldReturnEmptyWhenNoValue() {
         assertThat(
             CompletableFutureUtil.reduce(
                 (i, j) -> i + j,
@@ -261,7 +261,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void reduceShouldWork() {
+    void reduceShouldWork() {
         assertThat(
             CompletableFutureUtil.reduce(
                 (i, j) -> i + j,
@@ -272,7 +272,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void reduceShouldReturnIdentityAccumulatorWhenNoValue() {
+    void reduceShouldReturnIdentityAccumulatorWhenNoValue() {
         long identityAccumulator = 0L;
         assertThat(
             CompletableFutureUtil.reduce(
@@ -284,7 +284,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void reduceShouldWorkWithIdentityAccumulator() {
+    void reduceShouldWorkWithIdentityAccumulator() {
         assertThat(
             CompletableFutureUtil.reduce(
                 (i, j) -> i + j,
@@ -295,7 +295,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void unwrapShouldUnwrapWhenValue() {
+    void unwrapShouldUnwrapWhenValue() {
         assertThat(
             CompletableFutureUtil.unwrap(
                     CompletableFuture.completedFuture(Optional.of(CompletableFuture.completedFuture(1L))))
@@ -304,7 +304,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void unwrapShouldUnwrapWhenEmpty() {
+    void unwrapShouldUnwrapWhenEmpty() {
         assertThat(
             CompletableFutureUtil.unwrap(
                     CompletableFuture.completedFuture(Optional.empty()))
@@ -313,14 +313,14 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void sortShouldReturnEmptyWhenEmptyStream() {
+    void sortShouldReturnEmptyWhenEmptyStream() {
         FluentFutureStream<Long> futureStream = FluentFutureStream.ofFutures();
         assertThat(futureStream.sorted(Long::compareTo).join())
             .isEmpty();
     }
 
     @Test
-    public void sortShouldReturnTheSortedStream() {
+    void sortShouldReturnTheSortedStream() {
         FluentFutureStream<Long> futureStream = FluentFutureStream.ofFutures(
             CompletableFuture.completedFuture(4L),
             CompletableFuture.completedFuture(3L),
@@ -332,7 +332,7 @@ public class CompletableFutureUtilTest {
     }
 
     @Test
-    public void exceptionallyFutureShouldReturnACompletedExceptionallyFuture() {
+    void exceptionallyFutureShouldReturnACompletedExceptionallyFuture() {
         CompletableFuture<Object> failedFuture = CompletableFutureUtil.exceptionallyFuture(new Exception("failure"));
         assertThat(failedFuture)
             .isCompletedExceptionally();

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/FluentFutureStreamTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/FluentFutureStreamTest.java b/server/container/util/src/test/java/org/apache/james/util/FluentFutureStreamTest.java
index 56017d6..2745280 100644
--- a/server/container/util/src/test/java/org/apache/james/util/FluentFutureStreamTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/FluentFutureStreamTest.java
@@ -26,14 +26,14 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ConcurrentLinkedDeque;
 import java.util.stream.Stream;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import com.github.steveash.guavate.Guavate;
 
 public class FluentFutureStreamTest {
 
     @Test
-    public void ofFutureShouldConstructAFluentFutureStream() {
+    void ofFutureShouldConstructAFluentFutureStream() {
         assertThat(
             FluentFutureStream.ofFutures(
                 CompletableFuture.completedFuture(1),
@@ -45,7 +45,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void ofShouldConstructAFluentFutureStreamWhenProvidedAFutureOfStream() {
+    void ofShouldConstructAFluentFutureStreamWhenProvidedAFutureOfStream() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(
@@ -56,7 +56,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void ofShouldConstructAFluentFutureStreamWhenProvidedAStreamOfFuture() {
+    void ofShouldConstructAFluentFutureStreamWhenProvidedAStreamOfFuture() {
         assertThat(
             FluentFutureStream.of(
                 Stream.of(
@@ -69,7 +69,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void ofNestedStreamsShouldConstructAFluentFutureStreamWhenProvidedAStreamOfFutureOfStream() {
+    void ofNestedStreamsShouldConstructAFluentFutureStreamWhenProvidedAStreamOfFutureOfStream() {
         assertThat(
             FluentFutureStream.<Stream<Integer>, Integer>of(
                 Stream.of(
@@ -84,7 +84,7 @@ public class FluentFutureStreamTest {
 
 
     @Test
-    public void ofOptionalsShouldConstructAFluentFutureStreamWhenProvidedAStreamOfFutureOfOptionals() {
+    void ofOptionalsShouldConstructAFluentFutureStreamWhenProvidedAStreamOfFutureOfOptionals() {
         assertThat(
             FluentFutureStream.<Optional<Integer>, Integer>of(
                 Stream.of(
@@ -99,7 +99,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void completableFutureShouldReturnAFutureOfTheUnderLayingStream() {
+    void completableFutureShouldReturnAFutureOfTheUnderLayingStream() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(
@@ -111,7 +111,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void mapShouldTransformUnderlyingValues() {
+    void mapShouldTransformUnderlyingValues() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(
@@ -123,7 +123,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void flatMapShouldTransformUnderlyingValuesAndFlatMapResult() {
+    void flatMapShouldTransformUnderlyingValuesAndFlatMapResult() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(
@@ -135,7 +135,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void flatMapOptionalShouldTransformUnderlyingValuesAndUnboxResult() {
+    void flatMapOptionalShouldTransformUnderlyingValuesAndUnboxResult() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(
@@ -149,7 +149,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void reduceShouldGatherAllValuesOfTheUnderlyingStream() {
+    void reduceShouldGatherAllValuesOfTheUnderlyingStream() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(
@@ -160,7 +160,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void reduceShouldGatherAllValuesOfTheUnderlyingStreamWithAnEmptyValue() {
+    void reduceShouldGatherAllValuesOfTheUnderlyingStreamWithAnEmptyValue() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(
@@ -171,7 +171,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void filterShouldBeAppliedOnTheUnderlyingStream() {
+    void filterShouldBeAppliedOnTheUnderlyingStream() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(
@@ -183,7 +183,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void thenFilterShouldBeAppliedOnTheUnderlyingStream() {
+    void thenFilterShouldBeAppliedOnTheUnderlyingStream() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(
@@ -195,7 +195,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void thenComposeOnAllShouldTransformUnderlyingValuesAndComposeFutures() {
+    void thenComposeOnAllShouldTransformUnderlyingValuesAndComposeFutures() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(
@@ -207,7 +207,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void thenFlatComposeShouldTransformUnderlyingValuesAndComposeFuturesWithStreamUnboxing() {
+    void thenFlatComposeShouldTransformUnderlyingValuesAndComposeFuturesWithStreamUnboxing() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(
@@ -219,7 +219,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void thenFlatComposeOnOptionalShouldTransformUnderlyingValuesAndComposeFuturesWithOptionalUnboxing() {
+    void thenFlatComposeOnOptionalShouldTransformUnderlyingValuesAndComposeFuturesWithOptionalUnboxing() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(
@@ -233,7 +233,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void thenPerformOnAllShouldGenerateASynchronousSideEffectForAllElementsOfTheUnderlyingStream() {
+    void thenPerformOnAllShouldGenerateASynchronousSideEffectForAllElementsOfTheUnderlyingStream() {
         ConcurrentLinkedDeque<Integer> sideEffects = new ConcurrentLinkedDeque<>();
 
         FluentFutureStream.of(
@@ -250,7 +250,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void collectShouldReturnTheCollectionOfData() {
+    void collectShouldReturnTheCollectionOfData() {
         assertThat(
             FluentFutureStream.of(
                 Stream.of(
@@ -263,7 +263,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void collectShouldReturnEmptyWhenStreamIsEmpty() {
+    void collectShouldReturnEmptyWhenStreamIsEmpty() {
         assertThat(
             FluentFutureStream.ofFutures()
                 .collect(Guavate.toImmutableList())
@@ -272,7 +272,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void sortedShouldReturnInOrderElements() {
+    void sortedShouldReturnInOrderElements() {
         assertThat(
             FluentFutureStream.of(
                 CompletableFuture.completedFuture(Stream.of(4L, 3L, 2L, 1L)))
@@ -282,7 +282,7 @@ public class FluentFutureStreamTest {
     }
 
     @Test
-    public void sortedShouldReturnEmptyWhenEmpty() {
+    void sortedShouldReturnEmptyWhenEmpty() {
         CompletableFuture<Stream<Long>> completableFutureStream = CompletableFuture.completedFuture(Stream.of());
         assertThat(
             FluentFutureStream.of(completableFutureStream)
@@ -290,4 +290,4 @@ public class FluentFutureStreamTest {
                 .join())
             .isEmpty();
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/GuavaUtilsTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/GuavaUtilsTest.java b/server/container/util/src/test/java/org/apache/james/util/GuavaUtilsTest.java
index 2d5a224..5b2ec4d 100644
--- a/server/container/util/src/test/java/org/apache/james/util/GuavaUtilsTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/GuavaUtilsTest.java
@@ -23,7 +23,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import java.util.List;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableListMultimap;
@@ -32,7 +32,7 @@ import com.google.common.collect.ImmutableMap;
 public class GuavaUtilsTest {
 
     @Test
-    public void toMultimapShouldAcceptEmptyMaps() {
+    void toMultimapShouldAcceptEmptyMaps() {
         assertThat(GuavaUtils.toMultimap(ImmutableMap
             .<String, List<String>>builder()
             .build())
@@ -41,7 +41,7 @@ public class GuavaUtilsTest {
     }
 
     @Test
-    public void toMultimapShouldAcceptSingleValuesMaps() {
+    void toMultimapShouldAcceptSingleValuesMaps() {
         assertThat(GuavaUtils.toMultimap(ImmutableMap
             .<String, List<String>>builder()
             .put("k1", ImmutableList.of("v1"))
@@ -55,7 +55,7 @@ public class GuavaUtilsTest {
     }
 
     @Test
-    public void toMultimapShouldAcceptMultiplesValuesMaps() {
+    void toMultimapShouldAcceptMultiplesValuesMaps() {
         assertThat(GuavaUtils.toMultimap(ImmutableMap
             .<String, List<String>>builder()
             .put("k1", ImmutableList.of("v1"))
@@ -70,7 +70,7 @@ public class GuavaUtilsTest {
     }
 
     @Test
-    public void shouldStripEntriesWithEmptyList() {
+    void shouldStripEntriesWithEmptyList() {
         assertThat(GuavaUtils.toMultimap(ImmutableMap
             .<String, List<String>>builder()
             .put("k1", ImmutableList.of())
@@ -78,4 +78,4 @@ public class GuavaUtilsTest {
             .asMap())
             .isEqualTo(ImmutableListMultimap.of().asMap());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/HostTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/HostTest.java b/server/container/util/src/test/java/org/apache/james/util/HostTest.java
index 3ebeaee..2052b5e 100644
--- a/server/container/util/src/test/java/org/apache/james/util/HostTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/HostTest.java
@@ -20,10 +20,11 @@
 package org.apache.james.util;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
+import static org.assertj.core.api.Assertions.assertThatNullPointerException;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
@@ -31,25 +32,19 @@ public class HostTest {
 
     private static final int DEFAULT_PORT = 154;
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     @Test
-    public void parseConfStringShouldParseConfWithIpAndPort() {
-        //Given
+    void parseConfStringShouldParseConfWithIpAndPort() {
         int expectedPort = 44;
         String expectedIp = "142.145.254.111";
         String ipAndPort = expectedIp + ":" + 44;
 
-        //When
         Host actual = Host.parseConfString(ipAndPort);
 
-        //Then
         assertThat(actual).isEqualTo(new Host(expectedIp, expectedPort));
     }
 
     @Test
-    public void parseConfStringShouldParseConfWithHostanmeAndPort() {
+    void parseConfStringShouldParseConfWithHostanmeAndPort() {
         int expectedPort = 44;
         String host = "host";
 
@@ -59,98 +54,72 @@ public class HostTest {
     }
 
     @Test
-    public void parseConfStringShouldParseConfWithHostOnlyWhenDefaultPortIsProvided() {
-        //Given
+    void parseConfStringShouldParseConfWithHostOnlyWhenDefaultPortIsProvided() {
         String ipAndPort = "142.145.254.111";
         String expectedIp = "142.145.254.111";
 
-        //When
         Host actual = Host.parseConfString(ipAndPort, DEFAULT_PORT);
 
-        //Then
         assertThat(actual).isEqualTo(new Host(expectedIp, DEFAULT_PORT));
     }
 
     @Test
-    public void parseConfStringShouldFailWhenConfigIsAnEmptyString() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        //Given
-        String ipAndPort = "";
-
-        //When
-        Host.parseConfString(ipAndPort);
+    void parseConfStringShouldFailWhenConfigIsAnEmptyString() {
+        assertThatIllegalArgumentException()
+            .isThrownBy(() -> Host.parseConfString(""));
     }
 
     @Test
-    public void parseConfStringShouldFailWhenOnlyHostnameAndNoDefaultPort() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        //Given
-        String hostname = "hostnameOnly";
-
-        //When
-        Host.parseConfString(hostname);
+    void parseConfStringShouldFailWhenOnlyHostnameAndNoDefaultPort() {
+        assertThatIllegalArgumentException()
+            .isThrownBy(() -> Host.parseConfString("hostnameOnly"));
     }
 
     @Test
-    public void parseConfStringShouldFailWhenNegativePort() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        Host.parseConfString("host:-1");
+    void parseConfStringShouldFailWhenNegativePort() {
+        assertThatIllegalArgumentException()
+            .isThrownBy(() -> Host.parseConfString("host:-1"));
     }
 
     @Test
-    public void parseConfStringShouldFailWhenZeroPort() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        Host.parseConfString("host:0");
+    void parseConfStringShouldFailWhenZeroPort() {
+        assertThatIllegalArgumentException()
+            .isThrownBy(() -> Host.parseConfString("host:0"));
     }
 
     @Test
-    public void parseConfStringShouldFailWhenTooHighPort() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        Host.parseConfString("host:65536");
+    void parseConfStringShouldFailWhenTooHighPort() {
+        assertThatIllegalArgumentException()
+            .isThrownBy(() -> Host.parseConfString("host:65536"));
     }
 
     @Test
-    public void parseConfStringShouldFailWhenConfigIsANullString() {
-        expectedException.expect(NullPointerException.class);
-
-        //Given
-        String ipAndPort = null;
-
-        //When
-        Host.parseConfString(ipAndPort);
+    void parseConfStringShouldFailWhenConfigIsANullString() {
+        assertThatNullPointerException()
+            .isThrownBy(() -> Host.parseConfString(null));
     }
 
 
     @Test
-    public void parseConfStringShouldFailWhenConfigIsInvalid() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        //Given
-        String ipAndPort = "10.10.10.10:42:43";
-
-        //When
-        Host.parseConfString(ipAndPort);
+    void parseConfStringShouldFailWhenConfigIsInvalid() {
+        assertThatIllegalArgumentException()
+            .isThrownBy(() -> Host.parseConfString("10.10.10.10:42:43"));
     }
 
     @Test
-    public void parseHostsShouldParseEmptyString() {
+    void parseHostsShouldParseEmptyString() {
         assertThat(Host.parseHosts(""))
             .isEmpty();
     }
 
     @Test
-    public void parseHostsShouldParseMonoHost() {
+    void parseHostsShouldParseMonoHost() {
         assertThat(Host.parseHosts("localhost:9200"))
             .containsOnly(new Host("localhost", 9200));
     }
 
     @Test
-    public void parseHostsShouldParseMultiHosts() {
+    void parseHostsShouldParseMultiHosts() {
         assertThat(Host.parseHosts("localhost:9200,server:9155"))
             .containsOnly(
                 new Host("localhost", 9200),
@@ -158,7 +127,7 @@ public class HostTest {
     }
 
     @Test
-    public void parseHostsShouldNotFailOnMultiComma() {
+    void parseHostsShouldNotFailOnMultiComma() {
         assertThat(Host.parseHosts("localhost:9200,,server:9155"))
             .containsOnly(
                 new Host("localhost", 9200),
@@ -166,21 +135,20 @@ public class HostTest {
     }
 
     @Test
-    public void parseHostsShouldFailOnInvalidHost() {
-        expectedException.expect(NumberFormatException.class);
-
-        Host.parseHosts("localhost:invalid,,server:9155");
+    void parseHostsShouldFailOnInvalidHost() {
+        assertThatThrownBy(() -> Host.parseHosts("localhost:invalid,,server:9155"))
+            .isInstanceOf(NumberFormatException.class);
     }
 
     @Test
-    public void parseHostsShouldSwallowDuplicates() {
+    void parseHostsShouldSwallowDuplicates() {
         assertThat(Host.parseHosts("localhost:9200,localhost:9200"))
             .containsOnly(
                 new Host("localhost", 9200));
     }
 
     @Test
-    public void parseHostsShouldNotSwallowSameAddressDifferentPort() {
+    void parseHostsShouldNotSwallowSameAddressDifferentPort() {
         assertThat(Host.parseHosts("localhost:9200,localhost:9155"))
             .containsOnly(
                 new Host("localhost", 9200),
@@ -188,7 +156,7 @@ public class HostTest {
     }
 
     @Test
-    public void parseHostsShouldNotSwallowSamePortDifferentAddress() {
+    void parseHostsShouldNotSwallowSamePortDifferentAddress() {
         assertThat(Host.parseHosts("localhost:9200,abcd:9200"))
             .containsOnly(
                 new Host("localhost", 9200),
@@ -196,7 +164,7 @@ public class HostTest {
     }
 
     @Test
-    public void parseHostsShouldHandleDefaultPort() {
+    void parseHostsShouldHandleDefaultPort() {
         int defaultPort = 155;
 
         assertThat(Host.parseHosts("localhost:9200,abcd", defaultPort))
@@ -206,14 +174,13 @@ public class HostTest {
     }
 
     @Test
-    public void parseHostsShouldThrowOnAbsentPortWhenNoDefaultPort() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        Host.parseHosts("localhost:9200,abcd");
+    void parseHostsShouldThrowOnAbsentPortWhenNoDefaultPort() {
+        assertThatIllegalArgumentException()
+            .isThrownBy(() -> Host.parseHosts("localhost:9200,abcd"));
     }
 
     @Test
-    public void hostShouldRespectBeanContract() {
+    void hostShouldRespectBeanContract() {
         EqualsVerifier.forClass(Host.class).verify();
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/IteratorWrapperTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/IteratorWrapperTest.java b/server/container/util/src/test/java/org/apache/james/util/IteratorWrapperTest.java
index aa29e92..687f7b7 100644
--- a/server/container/util/src/test/java/org/apache/james/util/IteratorWrapperTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/IteratorWrapperTest.java
@@ -20,20 +20,16 @@
 package org.apache.james.util;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatNullPointerException;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
 public class IteratorWrapperTest {
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     @Test
-    public void getEntriesSeenShouldReturnEmptyWhenNotConsumed() {
+    void getEntriesSeenShouldReturnEmptyWhenNotConsumed() {
         ImmutableList<Integer> originalData = ImmutableList.of(1, 2, 3);
         IteratorWrapper<Integer> integerIteratorWrapper = new IteratorWrapper<>(originalData.iterator());
 
@@ -41,7 +37,7 @@ public class IteratorWrapperTest {
     }
 
     @Test
-    public void getEntriesSeenShouldReturnViewOfConsumedData() {
+    void getEntriesSeenShouldReturnViewOfConsumedData() {
         ImmutableList<Integer> originalData = ImmutableList.of(1, 2, 3);
         IteratorWrapper<Integer> integerIteratorWrapper = new IteratorWrapper<>(originalData.iterator());
 
@@ -52,7 +48,7 @@ public class IteratorWrapperTest {
     }
 
     @Test
-    public void getEntriesSeenShouldReturnViewOfConsumedDataWhenPartiallyConsumed() {
+    void getEntriesSeenShouldReturnViewOfConsumedDataWhenPartiallyConsumed() {
         ImmutableList<Integer> originalData = ImmutableList.of(1, 2, 3);
         IteratorWrapper<Integer> integerIteratorWrapper = new IteratorWrapper<>(originalData.iterator());
 
@@ -64,7 +60,7 @@ public class IteratorWrapperTest {
     }
 
     @Test
-    public void getEntriesSeenShouldReturnEmptyWhenSuppliedEmpty() {
+    void getEntriesSeenShouldReturnEmptyWhenSuppliedEmpty() {
         ImmutableList<Integer> originalData = ImmutableList.of();
         IteratorWrapper<Integer> integerIteratorWrapper = new IteratorWrapper<>(originalData.iterator());
 
@@ -75,10 +71,9 @@ public class IteratorWrapperTest {
     }
 
     @Test
-    public void constructorShouldThrowOnNull() {
-        expectedException.expect(NullPointerException.class);
-
-        new IteratorWrapper<Integer>(null);
+    void constructorShouldThrowOnNull() {
+        assertThatNullPointerException()
+            .isThrownBy(() -> new IteratorWrapper<Integer>(null));
     }
 
     private void consume(IteratorWrapper<Integer> integerIteratorWrapper) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/MDCBuilderTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/MDCBuilderTest.java b/server/container/util/src/test/java/org/apache/james/util/MDCBuilderTest.java
index bf09d1d..02494a8 100644
--- a/server/container/util/src/test/java/org/apache/james/util/MDCBuilderTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/MDCBuilderTest.java
@@ -20,13 +20,12 @@
 package org.apache.james.util;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatNullPointerException;
 
 import java.io.Closeable;
 import java.io.IOException;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
@@ -37,25 +36,22 @@ public class MDCBuilderTest {
     private static final String VALUE_1 = "value1";
     private static final String VALUE_2 = "value2";
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     @Test
-    public void addContextShouldThrowOnNullKey() {
-        expectedException.expect(NullPointerException.class);
-
-        MDCBuilder.create()
-            .addContext(null, "any");
+    void addContextShouldThrowOnNullKey() {
+        assertThatNullPointerException()
+            .isThrownBy(() -> 
+                MDCBuilder.create()
+                    .addContext(null, "any"));
     }
 
     @Test
-    public void buildContextMapShouldReturnEmptyWhenNoContext() {
+    void buildContextMapShouldReturnEmptyWhenNoContext() {
         assertThat(MDCBuilder.create().buildContextMap())
             .isEmpty();
     }
 
     @Test
-    public void buildContextMapShouldReturnContext() {
+    void buildContextMapShouldReturnContext() {
         assertThat(
             MDCBuilder.create()
                 .addContext(KEY_1, VALUE_1)
@@ -67,7 +63,7 @@ public class MDCBuilderTest {
     }
 
     @Test
-    public void addContextShouldFilterOutNullValues() {
+    void addContextShouldFilterOutNullValues() {
         assertThat(
             MDCBuilder.create()
                 .addContext(KEY_1, null)
@@ -76,7 +72,7 @@ public class MDCBuilderTest {
     }
 
     @Test
-    public void addContextShouldAllowRecursiveBuild() {
+    void addContextShouldAllowRecursiveBuild() {
         assertThat(
             MDCBuilder.create()
                 .addContext(KEY_1, VALUE_1)
@@ -88,22 +84,20 @@ public class MDCBuilderTest {
             .containsEntry(KEY_2, VALUE_2);
     }
 
-    @SuppressWarnings("resource")
     @Test
-    public void closeablesConstructorShouldThrowOnNullList() {
-        expectedException.expect(NullPointerException.class);
-
-        new MDCBuilder.Closeables(null);
+    void closeablesConstructorShouldThrowOnNullList() {
+        assertThatNullPointerException()
+            .isThrownBy(() -> new MDCBuilder.Closeables(null));
     }
 
     @Test
-    public void closeablesCloseShouldNotThrowWhenEmpty() throws IOException {
+    void closeablesCloseShouldNotThrowWhenEmpty() throws IOException {
         new MDCBuilder.Closeables(ImmutableList.of())
             .close();
     }
 
     @Test
-    public void closeablesCloseShouldCallAllUnderlyingCloseables() throws IOException {
+    void closeablesCloseShouldCallAllUnderlyingCloseables() throws IOException {
         ImmutableList.Builder<String> builder = ImmutableList.builder();
 
         Closeable closeable1 = () -> builder.add(VALUE_1);
@@ -119,7 +113,7 @@ public class MDCBuilderTest {
 
 
     @Test
-    public void closeablesCloseShouldCallAllUnderlyingCloseablesWhenError() throws IOException {
+    void closeablesCloseShouldCallAllUnderlyingCloseablesWhenError() throws IOException {
         ImmutableList.Builder<String> builder = ImmutableList.builder();
 
         Closeable closeable1 = () -> builder.add(VALUE_1);

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/OptionalUtilsTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/OptionalUtilsTest.java b/server/container/util/src/test/java/org/apache/james/util/OptionalUtilsTest.java
index 733e3e1..98812ab 100644
--- a/server/container/util/src/test/java/org/apache/james/util/OptionalUtilsTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/OptionalUtilsTest.java
@@ -23,24 +23,19 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.util.Optional;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 public class OptionalUtilsTest {
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
-
     @Test
-    public void ifEmptyShouldPreserveValueOfEmptyOptionals() {
+    void ifEmptyShouldPreserveValueOfEmptyOptionals() {
         Optional<Object> expected = OptionalUtils.executeIfEmpty(Optional.empty(), () -> { });
 
         assertThat(expected).isEmpty();
     }
 
     @Test
-    public void ifEmptyShouldPreserveValueOfPresentOptionals() {
+    void ifEmptyShouldPreserveValueOfPresentOptionals() {
         String value = "value";
         Optional<String> expected = OptionalUtils.executeIfEmpty(Optional.of(value), () -> { });
 
@@ -48,7 +43,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void ifEmptyShouldPerformOperationIfEmpty() {
+    void ifEmptyShouldPerformOperationIfEmpty() {
         AtomicInteger operationCounter = new AtomicInteger(0);
 
         OptionalUtils.executeIfEmpty(Optional.empty(), operationCounter::incrementAndGet);
@@ -57,7 +52,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void ifEmptyShouldNotPerformOperationIfPresent() {
+    void ifEmptyShouldNotPerformOperationIfPresent() {
         AtomicInteger operationCounter = new AtomicInteger(0);
 
         OptionalUtils.executeIfEmpty(Optional.of("value"), operationCounter::incrementAndGet);
@@ -66,26 +61,26 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void toStreamShouldConvertEmptyOptionalToEmptyStream() {
+    void toStreamShouldConvertEmptyOptionalToEmptyStream() {
         assertThat(OptionalUtils.toStream(Optional.empty()))
             .isEmpty();
     }
 
     @Test
-    public void toStreamShouldConvertFullOptionalToStream() {
+    void toStreamShouldConvertFullOptionalToStream() {
         long value = 18L;
         assertThat(OptionalUtils.toStream(Optional.of(value)))
             .containsExactly(value);
     }
 
     @Test
-    public void orShouldReturnEmptyWhenNoParameter() {
+    void orShouldReturnEmptyWhenNoParameter() {
         assertThat(OptionalUtils.or())
             .isEmpty();
     }
 
     @Test
-    public void orShouldReturnEmptyWhenEmpty() {
+    void orShouldReturnEmptyWhenEmpty() {
         assertThat(
             OptionalUtils.or(
                 Optional.empty()))
@@ -93,7 +88,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orShouldReturnValueWhenValue() {
+    void orShouldReturnValueWhenValue() {
         assertThat(
             OptionalUtils.or(
                 Optional.of(1)))
@@ -101,7 +96,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orShouldReturnEmptyWhenBothEmpty() {
+    void orShouldReturnEmptyWhenBothEmpty() {
         assertThat(
             OptionalUtils.or(
                 Optional.empty(),
@@ -110,7 +105,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orShouldReturnFirstValueWhenOnlyFirstValue() {
+    void orShouldReturnFirstValueWhenOnlyFirstValue() {
         assertThat(
             OptionalUtils.or(
                 Optional.of(18),
@@ -119,7 +114,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orShouldReturnSecondValueWhenOnlySecondValue() {
+    void orShouldReturnSecondValueWhenOnlySecondValue() {
         assertThat(
             OptionalUtils.or(
                 Optional.empty(),
@@ -128,7 +123,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orShouldReturnFirstValueWhenBothValues() {
+    void orShouldReturnFirstValueWhenBothValues() {
         assertThat(
             OptionalUtils.or(
                 Optional.of(1),
@@ -137,7 +132,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orShouldReturnThirdValueWhenOnlyThirdValue() {
+    void orShouldReturnThirdValueWhenOnlyThirdValue() {
         assertThat(
             OptionalUtils.or(
                 Optional.empty(),
@@ -147,13 +142,13 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orSuppliersShouldReturnEmptyWhenNoParameter() {
+    void orSuppliersShouldReturnEmptyWhenNoParameter() {
         assertThat(OptionalUtils.or())
             .isEmpty();
     }
 
     @Test
-    public void orSuppliersShouldReturnEmptyWhenEmpty() {
+    void orSuppliersShouldReturnEmptyWhenEmpty() {
         assertThat(
             OptionalUtils.orSuppliers(
                 Optional::empty))
@@ -161,7 +156,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orSuppliersShouldReturnValueWhenValue() {
+    void orSuppliersShouldReturnValueWhenValue() {
         assertThat(
             OptionalUtils.orSuppliers(
                 () -> Optional.of(1)))
@@ -169,7 +164,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orSuppliersShouldReturnEmptyWhenBothEmpty() {
+    void orSuppliersShouldReturnEmptyWhenBothEmpty() {
         assertThat(
             OptionalUtils.orSuppliers(
                 () -> Optional.empty(),
@@ -178,7 +173,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orSuppliersShouldReturnFirstValueWhenOnlyFirstValue() {
+    void orSuppliersShouldReturnFirstValueWhenOnlyFirstValue() {
         assertThat(
             OptionalUtils.orSuppliers(
                 () -> Optional.of(18),
@@ -187,7 +182,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orSuppliersShouldReturnSecondValueWhenOnlySecondValue() {
+    void orSuppliersShouldReturnSecondValueWhenOnlySecondValue() {
         assertThat(
             OptionalUtils.orSuppliers(
                 Optional::empty,
@@ -196,7 +191,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orSuppliersShouldReturnFirstValueWhenBothValues() {
+    void orSuppliersShouldReturnFirstValueWhenBothValues() {
         assertThat(
             OptionalUtils.orSuppliers(
                 () -> Optional.of(1),
@@ -205,7 +200,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void orSuppliersShouldReturnThirdValueWhenOnlyThirdValue() {
+    void orSuppliersShouldReturnThirdValueWhenOnlyThirdValue() {
         assertThat(
             OptionalUtils.orSuppliers(
                 Optional::empty,
@@ -215,27 +210,27 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void containsDifferentShouldReturnTrueWhenNullStoreValue() throws Exception {
+    void containsDifferentShouldReturnTrueWhenNullStoreValue() throws Exception {
         assertThat(OptionalUtils.containsDifferent(Optional.of("any"), null)).isTrue();
     }
 
     @Test
-    public void containsDifferentShouldReturnFalseWhenEmpty() throws Exception {
+    void containsDifferentShouldReturnFalseWhenEmpty() throws Exception {
         assertThat(OptionalUtils.containsDifferent(Optional.empty(), "any")).isFalse();
     }
 
     @Test
-    public void containsDifferentShouldReturnFalseWhenSameValue() throws Exception {
+    void containsDifferentShouldReturnFalseWhenSameValue() throws Exception {
         assertThat(OptionalUtils.containsDifferent(Optional.of("any"), "any")).isFalse();
     }
 
     @Test
-    public void containsDifferentShouldReturnTrueWhenDifferentValue() throws Exception {
+    void containsDifferentShouldReturnTrueWhenDifferentValue() throws Exception {
         assertThat(OptionalUtils.containsDifferent(Optional.of("any"), "other")).isTrue();
     }
 
     @Test
-    public void matchesShouldReturnFalseWhenFirstOptionalIsEmpty() {
+    void matchesShouldReturnFalseWhenFirstOptionalIsEmpty() {
         assertThat(
             OptionalUtils.matches(
                 Optional.empty(),
@@ -245,7 +240,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void matchesShouldReturnFalseWhenSecondOptionalIsEmpty() {
+    void matchesShouldReturnFalseWhenSecondOptionalIsEmpty() {
         assertThat(
             OptionalUtils.matches(
                 Optional.of(42),
@@ -255,7 +250,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void matchesShouldReturnFalseWhenBothOptionalsAreEmpty() {
+    void matchesShouldReturnFalseWhenBothOptionalsAreEmpty() {
         assertThat(
             OptionalUtils.matches(
                 Optional.empty(),
@@ -265,7 +260,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void matchesShouldReturnFalseWhenConditionIsNotMatching() {
+    void matchesShouldReturnFalseWhenConditionIsNotMatching() {
         assertThat(
             OptionalUtils.matches(
                 Optional.of(42),
@@ -275,7 +270,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    public void matchesShouldReturnTrueWhenConditionIsMatching() {
+    void matchesShouldReturnTrueWhenConditionIsMatching() {
         assertThat(
             OptionalUtils.matches(
                 Optional.of(42),

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/PortTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/PortTest.java b/server/container/util/src/test/java/org/apache/james/util/PortTest.java
index 9d04204..7e2c129 100644
--- a/server/container/util/src/test/java/org/apache/james/util/PortTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/PortTest.java
@@ -22,71 +22,71 @@ package org.apache.james.util;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class PortTest {
     @Test
-    public void assertValidShouldThrowOnNegativePort() {
+    void assertValidShouldThrowOnNegativePort() {
         assertThatThrownBy(() -> Port.assertValid(-1))
             .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void assertValidShouldThrowOnZeroPort() {
+    void assertValidShouldThrowOnZeroPort() {
         assertThatThrownBy(() -> Port.assertValid(0))
             .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void assertValidShouldAcceptOne() {
+    void assertValidShouldAcceptOne() {
         Port.assertValid(1);
     }
 
     @Test
-    public void assertValidShouldAcceptMaxValue() {
+    void assertValidShouldAcceptMaxValue() {
         Port.assertValid(Port.MAX_PORT_VALUE);
     }
 
     @Test
-    public void assertValidShouldThrowOnTooBigValue() {
+    void assertValidShouldThrowOnTooBigValue() {
         assertThatThrownBy(() -> Port.assertValid(Port.MAX_PORT_VALUE + 1))
             .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void isValidShouldReturnFalseWhenNegative() {
+    void isValidShouldReturnFalseWhenNegative() {
         assertThat(Port.isValid(-1))
             .isFalse();
     }
 
     @Test
-    public void isValidShouldReturnFalseWhenZero() {
+    void isValidShouldReturnFalseWhenZero() {
         assertThat(Port.isValid(0))
             .isFalse();
     }
 
     @Test
-    public void isValidShouldReturnTrueWhenOne() {
+    void isValidShouldReturnTrueWhenOne() {
         assertThat(Port.isValid(1))
             .isTrue();
     }
 
     @Test
-    public void isValidShouldReturnTrueWhenMaxValue() {
+    void isValidShouldReturnTrueWhenMaxValue() {
         assertThat(Port.isValid(Port.MAX_PORT_VALUE))
             .isTrue();
     }
 
     @Test
-    public void isValidShouldReturnFalseWhenAboveMaxValue() {
+    void isValidShouldReturnFalseWhenAboveMaxValue() {
         assertThat(Port.isValid(Port.MAX_PORT_VALUE + 1))
             .isFalse();
     }
 
     @Test
-    public void generateValidUnprivilegedPortShouldReturnAValidPort() {
+    void generateValidUnprivilegedPortShouldReturnAValidPort() {
         assertThat(Port.generateValidUnprivilegedPort())
             .isBetween(Port.PRIVILEGED_PORT_BOUND, Port.MAX_PORT_VALUE);
     }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/SizeFormatTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/SizeFormatTest.java b/server/container/util/src/test/java/org/apache/james/util/SizeFormatTest.java
index f506cc5..ef492a4 100644
--- a/server/container/util/src/test/java/org/apache/james/util/SizeFormatTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/SizeFormatTest.java
@@ -22,68 +22,68 @@ package org.apache.james.util;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class SizeFormatTest {
 
     @Test
-    public void formatShouldThrowWhenNegative() {
+    void formatShouldThrowWhenNegative() {
         assertThatThrownBy(() -> SizeFormat.format(-1))
             .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void formatShouldAcceptZero() {
+    void formatShouldAcceptZero() {
         assertThat(SizeFormat.format(0))
             .isEqualTo("0 bytes");
     }
 
     @Test
-    public void formatShouldUseByteWhenAlmostKiB() {
+    void formatShouldUseByteWhenAlmostKiB() {
         assertThat(SizeFormat.format(1023))
             .isEqualTo("1023 bytes");
     }
 
     @Test
-    public void formatShouldUseKiBWhenExactlyOneKiB() {
+    void formatShouldUseKiBWhenExactlyOneKiB() {
         assertThat(SizeFormat.format(1024))
             .isEqualTo("1 KiB");
     }
 
     @Test
-    public void formatShouldHaveTwoDigitPrecision() {
+    void formatShouldHaveTwoDigitPrecision() {
         assertThat(SizeFormat.format(1024 + 100))
             .isEqualTo("1.09 KiB");
     }
 
     @Test
-    public void formatShouldBeExpressedInKiBWhenAlmostMiB() {
+    void formatShouldBeExpressedInKiBWhenAlmostMiB() {
         assertThat(SizeFormat.format(1024 * 1024 - 1))
             .isEqualTo("1023.99 KiB");
     }
 
     @Test
-    public void formatShouldKeepTwoDigitPrecisionWhenRoundingDown() {
+    void formatShouldKeepTwoDigitPrecisionWhenRoundingDown() {
         assertThat(SizeFormat.format(2 * 1024 * 1024 - 1))
             .isEqualTo("1.99 MiB");
     }
 
     @Test
-    public void formatShouldUseMiBWhenExactlyOneMiB() {
+    void formatShouldUseMiBWhenExactlyOneMiB() {
         assertThat(SizeFormat.format(1024 * 1024))
             .isEqualTo("1 MiB");
     }
 
     @Test
-    public void formatShouldUseGiBWhenExactlyOneGiB() {
+    void formatShouldUseGiBWhenExactlyOneGiB() {
         assertThat(SizeFormat.format(1024 * 1024 * 1024))
             .isEqualTo("1 GiB");
     }
 
     @Test
-    public void formatShouldUseTiBWhenExactlyOneTiB() {
+    void formatShouldUseTiBWhenExactlyOneTiB() {
         assertThat(SizeFormat.format(1024L * 1024L * 1024L * 1024L))
             .isEqualTo("1 TiB");
     }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/SizeTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/SizeTest.java b/server/container/util/src/test/java/org/apache/james/util/SizeTest.java
index 0aaeae2..bc73a77 100644
--- a/server/container/util/src/test/java/org/apache/james/util/SizeTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/SizeTest.java
@@ -20,54 +20,57 @@
 package org.apache.james.util;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class SizeTest {
 
     @Test
-    public void testNoUnit() throws Exception {
+    void testNoUnit() throws Exception {
         assertThat(Size.parse("1024").asBytes()).isEqualTo(1024);
     }
 
     @Test
-    public void testUnitB() throws Exception {
+    void testUnitB() throws Exception {
         assertThat(Size.parse("1024B").asBytes()).isEqualTo(1024);
     }
 
     @Test
-    public void testUnitK() throws Exception {
+    void testUnitK() throws Exception {
         assertThat(Size.parse("5K").asBytes()).isEqualTo(5 * 1024);
     }
 
     @Test
-    public void testUnitM() throws Exception {
+    void testUnitM() throws Exception {
         assertThat(Size.parse("5M").asBytes()).isEqualTo(5 * 1024 * 1024);
     }
 
     @Test
-    public void testUnitG() throws Exception {
+    void testUnitG() throws Exception {
         assertThat(Size.parse("1G").asBytes()).isEqualTo(1024 * 1024 * 1024);
     }
 
     @Test
-    public void testUnknown() throws Exception {
+    void testUnknown() throws Exception {
         assertThat(Size.parse("unknown").asBytes()).isEqualTo(Size.UNKNOWN_VALUE);
     }
 
     @Test
-    public void testUnlimited() throws Exception {
+    void testUnlimited() throws Exception {
         assertThat(Size.parse("unlimited").asBytes()).isEqualTo(Size.UNLIMITED_VALUE);
     }
 
-    @Test(expected = Exception.class)
-    public void testBadUnit() throws Exception {
-        Size.parse("42T");
+    @Test
+    void testBadUnit() {
+        assertThatThrownBy(() -> Size.parse("42T"))
+            .isInstanceOf(Exception.class);
     }
 
-    @Test(expected = NumberFormatException.class)
-    public void testWrongNumber() throws Exception {
-        Size.parse("42RG");
+    @Test
+    void testWrongNumber() throws Exception {
+        assertThatThrownBy(() -> Size.parse("42RG"))
+            .isInstanceOf(NumberFormatException.class);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/StreamUtilsTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/StreamUtilsTest.java b/server/container/util/src/test/java/org/apache/james/util/StreamUtilsTest.java
index 691c671..75f2526 100644
--- a/server/container/util/src/test/java/org/apache/james/util/StreamUtilsTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/StreamUtilsTest.java
@@ -24,7 +24,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.stream.Stream;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import com.github.steveash.guavate.Guavate;
 import com.google.common.collect.ImmutableList;
@@ -32,7 +32,7 @@ import com.google.common.collect.ImmutableList;
 public class StreamUtilsTest {
 
     @Test
-    public void flattenShouldReturnEmptyWhenEmptyStreams() {
+    void flattenShouldReturnEmptyWhenEmptyStreams() {
         assertThat(
             StreamUtils.<Integer>flatten(ImmutableList.of())
                 .collect(Guavate.toImmutableList()))
@@ -40,7 +40,7 @@ public class StreamUtilsTest {
     }
 
     @Test
-    public void flattenShouldPreserveSingleStreams() {
+    void flattenShouldPreserveSingleStreams() {
         assertThat(
             StreamUtils.flatten(ImmutableList.of(
                 Stream.of(1, 2, 3)))
@@ -49,7 +49,7 @@ public class StreamUtilsTest {
     }
 
     @Test
-    public void flattenShouldMergeSeveralStreamsTogether() {
+    void flattenShouldMergeSeveralStreamsTogether() {
         assertThat(
             StreamUtils.flatten(ImmutableList.of(
                 Stream.of(1, 2, 3),
@@ -59,7 +59,7 @@ public class StreamUtilsTest {
     }
 
     @Test
-    public void flattenShouldAcceptEmptyStreams() {
+    void flattenShouldAcceptEmptyStreams() {
         assertThat(
             StreamUtils.flatten(ImmutableList.of(
                 Stream.of()))
@@ -68,7 +68,7 @@ public class StreamUtilsTest {
     }
 
     @Test
-    public void flattenShouldMergeEmptyStreamsWithOtherData() {
+    void flattenShouldMergeEmptyStreamsWithOtherData() {
         assertThat(
             StreamUtils.flatten(ImmutableList.of(
                 Stream.of(1, 2),
@@ -79,7 +79,7 @@ public class StreamUtilsTest {
     }
 
     @Test
-    public void flattenShouldAcceptEmptyVarArg() {
+    void flattenShouldAcceptEmptyVarArg() {
         assertThat(
             StreamUtils.flatten()
                 .collect(Guavate.toImmutableList()))
@@ -87,29 +87,29 @@ public class StreamUtilsTest {
     }
 
     @Test
-    public void flattenShouldThrowOnNullVarArg() {
+    void flattenShouldThrowOnNullVarArg() {
         Stream<String>[] streams = null;
         assertThatThrownBy(() -> StreamUtils.flatten(streams).collect(Guavate.toImmutableList()))
             .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void flattenShouldFlattenNonEmptyVarArg() {
+    void flattenShouldFlattenNonEmptyVarArg() {
         assertThat(StreamUtils.flatten(Stream.of(1), Stream.of(2)).collect(Guavate.toImmutableList()))
             .containsExactly(1, 2);
     }
 
     @Test
-    public void ofNullableShouldReturnEmptyStreamWhenNull() {
+    void ofNullableShouldReturnEmptyStreamWhenNull() {
         assertThat(StreamUtils.ofNullable(null)
             .collect(Guavate.toImmutableList()))
             .isEmpty();
     }
 
     @Test
-    public void ofNullableShouldReturnAStreamWithElementsOfTheArray() {
+    void ofNullableShouldReturnAStreamWithElementsOfTheArray() {
         assertThat(StreamUtils.ofNullable(ImmutableList.of(1, 2).toArray())
             .collect(Guavate.toImmutableList()))
             .containsExactly(1, 2);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/c0b58116/server/container/util/src/test/java/org/apache/james/util/TimeConverterTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/TimeConverterTest.java b/server/container/util/src/test/java/org/apache/james/util/TimeConverterTest.java
index 2a826c1..2d64018 100644
--- a/server/container/util/src/test/java/org/apache/james/util/TimeConverterTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/TimeConverterTest.java
@@ -19,15 +19,16 @@
 package org.apache.james.util;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.concurrent.TimeUnit;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TimeConverterTest {
-    
+
     @Test
-    public void getMilliSecondsShouldConvertValueWhenNoUnitAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenNoUnitAmountAsString() {
         //Given
         long expected = 2;
         //When
@@ -37,7 +38,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldUseProvidedUnitWhenNoUnitAmountAsString() {
+    void getMilliSecondsShouldUseProvidedUnitWhenNoUnitAmountAsString() {
         //Given
         long expected = 2000;
         //When
@@ -47,7 +48,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldNotUseProvidedUnitWhenNoUnitAmountAsString() {
+    void getMilliSecondsShouldNotUseProvidedUnitWhenNoUnitAmountAsString() {
         //Given
         long expected = 120000;
         //When
@@ -56,8 +57,8 @@ public class TimeConverterTest {
         assertThat(actual).isEqualTo(expected);
     }
 
-    @Test 
-    public void getMilliSecondsShouldConvertValueWhenMsecUnit() {
+    @Test
+    void getMilliSecondsShouldConvertValueWhenMsecUnit() {
         //Given
         long expected = 2;
         //When
@@ -67,7 +68,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenMsecAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenMsecAmountAsString() {
         //Given
         long expected = 2;
         //When
@@ -77,7 +78,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenMsUnit() {
+    void getMilliSecondsShouldConvertValueWhenMsUnit() {
         //Given
         long expected = 2;
         //When
@@ -87,7 +88,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenMsAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenMsAmountAsString() {
         //Given
         long expected = 2;
         //When
@@ -97,7 +98,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenMsUnitCapital() {
+    void getMilliSecondsShouldConvertValueWhenMsUnitCapital() {
         //Given
         long expected = 2;
         //When
@@ -107,7 +108,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenMsCapitalAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenMsCapitalAmountAsString() {
         //Given
         long expected = 2;
         //When
@@ -115,9 +116,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-   
+
     @Test
-    public void getMilliSecondsShouldConvertValueWhenMsecsUnit() {
+    void getMilliSecondsShouldConvertValueWhenMsecsUnit() {
         //Given
         long expected = 2;
         //When
@@ -125,9 +126,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-    
+
     @Test
-    public void getMilliSecondsShouldConvertValueWhenMsecsAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenMsecsAmountAsString() {
         //Given
         long expected = 2;
         //When
@@ -137,7 +138,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenSUnit() {
+    void getMilliSecondsShouldConvertValueWhenSUnit() {
         //Given
         long expected = TimeUnit.SECONDS.toMillis(2);
         //When
@@ -147,7 +148,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenSAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenSAmountAsString() {
         //Given
         long expected = TimeUnit.SECONDS.toMillis(2);
         //When
@@ -155,9 +156,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-    
-    @Test 
-    public void getMilliSecondsShouldConvertValueWhenSecUnit() { 
+
+    @Test
+    void getMilliSecondsShouldConvertValueWhenSecUnit() {
         //Given
         long expected = TimeUnit.SECONDS.toMillis(2);
         //When
@@ -165,9 +166,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-    
-    @Test 
-    public void getMilliSecondsShouldConvertValueWhenSecAmountAsString() {
+
+    @Test
+    void getMilliSecondsShouldConvertValueWhenSecAmountAsString() {
         //Given
         long expected = TimeUnit.SECONDS.toMillis(2);
         //When
@@ -177,7 +178,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenSecCapitalUnit() {
+    void getMilliSecondsShouldConvertValueWhenSecCapitalUnit() {
         //Given
         long expected = TimeUnit.SECONDS.toMillis(2);
         //When
@@ -187,7 +188,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenSecCapitalAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenSecCapitalAmountAsString() {
         //Given
         long expected = TimeUnit.SECONDS.toMillis(2);
         //When
@@ -195,18 +196,18 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-    
-    @Test 
-    public void getMilliSecondsShouldConvertValueWhenSecsUnit() {
+
+    @Test
+    void getMilliSecondsShouldConvertValueWhenSecsUnit() {
         long expected = TimeUnit.SECONDS.toMillis(2);
         //When
         long actual = TimeConverter.getMilliSeconds(2, "secs");
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-    
-    @Test 
-    public void getMilliSecondsShouldConvertValueWhenSecsAmountAsString() {
+
+    @Test
+    void getMilliSecondsShouldConvertValueWhenSecsAmountAsString() {
         //Given
         long expected = TimeUnit.SECONDS.toMillis(2);
         //When
@@ -216,7 +217,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenMUnit() {
+    void getMilliSecondsShouldConvertValueWhenMUnit() {
         //Given
         long expected = TimeUnit.MINUTES.toMillis(2);
         //When
@@ -226,7 +227,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenMAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenMAmountAsString() {
         //Given
         long expected = TimeUnit.MINUTES.toMillis(2);
         //When
@@ -235,8 +236,8 @@ public class TimeConverterTest {
         assertThat(actual).isEqualTo(expected);
     }
 
-    @Test 
-    public void getMilliSecondsShouldConvertValueWhenMinuteUnit() {
+    @Test
+    void getMilliSecondsShouldConvertValueWhenMinuteUnit() {
         //Given
         long expected = TimeUnit.MINUTES.toMillis(2);
         //When
@@ -244,9 +245,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-        
-    @Test 
-    public void getMilliSecondsShouldConvertValueWhenMinuteAmountAsString() {
+
+    @Test
+    void getMilliSecondsShouldConvertValueWhenMinuteAmountAsString() {
         //Given
         long expected = TimeUnit.MINUTES.toMillis(2);
         //When
@@ -256,7 +257,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenMinuteCapitalUnit() {
+    void getMilliSecondsShouldConvertValueWhenMinuteCapitalUnit() {
         //Given
         long expected = TimeUnit.MINUTES.toMillis(2);
         //When
@@ -266,7 +267,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenMinuteCapitalAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenMinuteCapitalAmountAsString() {
         //Given
         long expected = TimeUnit.MINUTES.toMillis(2);
         //When
@@ -276,7 +277,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenMinutesUnit() {
+    void getMilliSecondsShouldConvertValueWhenMinutesUnit() {
         //Given
         long expected = TimeUnit.MINUTES.toMillis(2);
         //When
@@ -284,9 +285,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-        
-    @Test 
-    public void getMilliSecondsShouldConvertValueWhenMinutesAmountAsString() {
+
+    @Test
+    void getMilliSecondsShouldConvertValueWhenMinutesAmountAsString() {
         //Given
         long expected = TimeUnit.MINUTES.toMillis(2);
         //When
@@ -296,7 +297,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenHUnit() {
+    void getMilliSecondsShouldConvertValueWhenHUnit() {
         //Given
         long expected = TimeUnit.HOURS.toMillis(2);
         //When
@@ -306,7 +307,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenHAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenHAmountAsString() {
         //Given
         long expected = TimeUnit.HOURS.toMillis(2);
         //When
@@ -316,7 +317,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenHourUnit() {
+    void getMilliSecondsShouldConvertValueWhenHourUnit() {
         //Given
         long expected = TimeUnit.HOURS.toMillis(2);
         //When
@@ -324,9 +325,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-        
+
     @Test
-    public void getMilliSecondsShouldConvertValueWhenHourAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenHourAmountAsString() {
         //Given
         long expected = TimeUnit.HOURS.toMillis(2);
         //When
@@ -336,7 +337,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenHourCapitalUnit() {
+    void getMilliSecondsShouldConvertValueWhenHourCapitalUnit() {
         //Given
         long expected = TimeUnit.HOURS.toMillis(2);
         //When
@@ -346,7 +347,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenHourCapitalAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenHourCapitalAmountAsString() {
         //Given
         long expected = TimeUnit.HOURS.toMillis(2);
         //When
@@ -354,9 +355,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-    
+
     @Test
-    public void getMilliSecondsShouldConvertValueWhenHoursUnit() {
+    void getMilliSecondsShouldConvertValueWhenHoursUnit() {
         //Given
         long expected = TimeUnit.HOURS.toMillis(2);
         //When
@@ -364,9 +365,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-        
-    @Test 
-    public void getMilliSecondsShouldConvertValueWhenHoursAmountAsString() {
+
+    @Test
+    void getMilliSecondsShouldConvertValueWhenHoursAmountAsString() {
         //Given
         long expected = TimeUnit.HOURS.toMillis(2);
         //When
@@ -376,7 +377,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenDUnit() {
+    void getMilliSecondsShouldConvertValueWhenDUnit() {
         //Given
         long expected = TimeUnit.DAYS.toMillis(2);
         //When
@@ -386,7 +387,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenDAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenDAmountAsString() {
         //Given
         long expected = TimeUnit.DAYS.toMillis(2);
         //When
@@ -394,9 +395,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-    
+
     @Test
-    public void getMilliSecondsShouldConvertValueWhenDayUnit() {
+    void getMilliSecondsShouldConvertValueWhenDayUnit() {
         //Given
         long expected = TimeUnit.DAYS.toMillis(2);
         //When
@@ -404,9 +405,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-        
+
     @Test
-    public void getMilliSecondsShouldConvertValueWhenDayAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenDayAmountAsString() {
         //Given
         long expected = TimeUnit.DAYS.toMillis(2);
         //When
@@ -416,7 +417,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenDayCapitalUnit() {
+    void getMilliSecondsShouldConvertValueWhenDayCapitalUnit() {
         //Given
         long expected = TimeUnit.DAYS.toMillis(2);
         //When
@@ -426,7 +427,7 @@ public class TimeConverterTest {
     }
 
     @Test
-    public void getMilliSecondsShouldConvertValueWhenDayCapitalAmountAsString() {
+    void getMilliSecondsShouldConvertValueWhenDayCapitalAmountAsString() {
         //Given
         long expected = TimeUnit.DAYS.toMillis(2);
         //When
@@ -434,9 +435,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-    
+
     @Test
-    public void getMilliSecondsShouldConvertValueWhenDaysUnit() {
+    void getMilliSecondsShouldConvertValueWhenDaysUnit() {
         //Given
         long expected = TimeUnit.DAYS.toMillis(2);
         //When
@@ -444,9 +445,9 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-        
-    @Test 
-    public void getMilliSecondsShouldConvertValueWhenDaysAmountAsString() {
+
+    @Test
+    void getMilliSecondsShouldConvertValueWhenDaysAmountAsString() {
         //Given
         long expected = TimeUnit.DAYS.toMillis(2);
         //When
@@ -454,19 +455,22 @@ public class TimeConverterTest {
         //Then
         assertThat(actual).isEqualTo(expected);
     }
-    
-    @Test(expected = NumberFormatException.class) 
-    public void getMilliSecondsShouldThrowWhenIllegalUnitInUnit() {
-        TimeConverter.getMilliSeconds(2, "week");
-    } 
-    
-    @Test(expected = NumberFormatException.class) 
-    public void getMilliSecondsShouldThrowWhenIllegalUnitInRawString() { 
-        TimeConverter.getMilliSeconds("2 week");
-    } 
 
-    @Test (expected = NumberFormatException.class)
-    public void getMilliSecondsShouldThrowWhenIllegalPattern() {
-        TimeConverter.getMilliSeconds("illegal pattern");
+    @Test
+    void getMilliSecondsShouldThrowWhenIllegalUnitInUnit() {
+        assertThatThrownBy(() -> TimeConverter.getMilliSeconds(2, "week"))
+            .isInstanceOf(NumberFormatException.class);
+    }
+
+    @Test
+    void getMilliSecondsShouldThrowWhenIllegalUnitInRawString() {
+        assertThatThrownBy(() -> TimeConverter.getMilliSeconds("2 week"))
+            .isInstanceOf(NumberFormatException.class);
+    }
+
+    @Test
+    void getMilliSecondsShouldThrowWhenIllegalPattern() {
+        assertThatThrownBy(() -> TimeConverter.getMilliSeconds("illegal pattern"))
+            .isInstanceOf(NumberFormatException.class);
     }
-}
\ No newline at end of file
+}


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