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

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

commit 2513f8b00272163ac3c3777bfaa4bb2afc160cf2
Author: Rene Cordier <[email protected]>
AuthorDate: Fri Jul 31 14:02:47 2020 +0700

    [Refactoring] Migrate DispositionModifierTest to JUnit5
---
 .../mdn/modifier/DispositionModifierTest.java      | 55 +++++++++-------------
 1 file changed, 23 insertions(+), 32 deletions(-)

diff --git 
a/mdn/src/test/java/org/apache/james/mdn/modifier/DispositionModifierTest.java 
b/mdn/src/test/java/org/apache/james/mdn/modifier/DispositionModifierTest.java
index 64ee91b..eaf02e8 100644
--- 
a/mdn/src/test/java/org/apache/james/mdn/modifier/DispositionModifierTest.java
+++ 
b/mdn/src/test/java/org/apache/james/mdn/modifier/DispositionModifierTest.java
@@ -19,62 +19,53 @@
 
 package org.apache.james.mdn.modifier;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import nl.jqno.equalsverifier.EqualsVerifier;
+import org.junit.jupiter.api.Test;
 
-public class DispositionModifierTest {
+import nl.jqno.equalsverifier.EqualsVerifier;
 
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
+class DispositionModifierTest {
 
     @Test
-    public void shouldMatchBeanContract() throws Exception {
+    void shouldMatchBeanContract() {
         EqualsVerifier.forClass(DispositionModifier.class)
             .verify();
     }
 
     @Test
-    public void shouldThrowOnNull() {
-        expectedException.expect(NullPointerException.class);
-
-        new DispositionModifier(null);
+    void shouldThrowOnNull() {
+        assertThatThrownBy(() -> new DispositionModifier(null))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void shouldThrowOnMultiLine() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        new DispositionModifier("multi\nline");
+    void shouldThrowOnMultiLine() {
+        assertThatThrownBy(() -> new DispositionModifier("multi\nline"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void shouldThrowOnEndBreakLine() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        new DispositionModifier("multi\n");
+    void shouldThrowOnEndBreakLine() {
+        assertThatThrownBy(() -> new DispositionModifier("multi\n"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void shouldThrowOnBeginningBreakLine() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        new DispositionModifier("\nline");
+    void shouldThrowOnBeginningBreakLine() {
+        assertThatThrownBy(() -> new DispositionModifier("\nline"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void shouldThrowOnEmptyValue() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        new DispositionModifier("");
+    void shouldThrowOnEmptyValue() {
+        assertThatThrownBy(() -> new DispositionModifier(""))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void shouldThrowOnFoldingWhiteSpaceValue() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        new DispositionModifier("    ");
+    void shouldThrowOnFoldingWhiteSpaceValue() {
+        assertThatThrownBy(() -> new DispositionModifier("    "))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to