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

[james-project] 10/23: [Refactoring] Migrate ErrorTest to JUnit5

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 ffe56a572933cb1ca588996d927c555b34ef5cdf
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Fri Jul 31 14:08:20 2020 +0700

    [Refactoring] Migrate ErrorTest to JUnit5
---
 .../org/apache/james/mdn/fields/ErrorTest.java     | 23 +++++++++-------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/mdn/src/test/java/org/apache/james/mdn/fields/ErrorTest.java b/mdn/src/test/java/org/apache/james/mdn/fields/ErrorTest.java
index 0f50d48..d60b33b 100644
--- a/mdn/src/test/java/org/apache/james/mdn/fields/ErrorTest.java
+++ b/mdn/src/test/java/org/apache/james/mdn/fields/ErrorTest.java
@@ -20,40 +20,35 @@
 package org.apache.james.mdn.fields;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class ErrorTest {
-
-    @Rule
-    public ExpectedException expectedException = ExpectedException.none();
+class ErrorTest {
 
     @Test
-    public void shouldMatchBeanContract() throws Exception {
+    void shouldMatchBeanContract() {
         EqualsVerifier.forClass(Error.class)
             .verify();
     }
 
     @Test
-    public void shouldThrowOnNullText() {
-        expectedException.expect(NullPointerException.class);
-
-        new Error(null);
+    void shouldThrowOnNullText() {
+        assertThatThrownBy(() -> new Error(null))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void formattedValueShouldDisplayMessage() {
+    void formattedValueShouldDisplayMessage() {
         assertThat(new Error(Text.fromRawText("Message"))
             .formattedValue())
             .isEqualTo("Error: Message");
     }
 
     @Test
-    public void formattedValueShouldDisplayMultiLineMessage() {
+    void formattedValueShouldDisplayMultiLineMessage() {
         assertThat(new Error(Text.fromRawText("Multi\nline\nMessage"))
             .formattedValue())
             .isEqualTo("Error: Multi\r\n line\r\n Message");


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