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 2020/06/08 13:16:18 UTC

[james-project] 24/30: JAMES-3179 Migrate ImapFeaturesTest to JUnit 5

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

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

commit 89f364b1f7191d3dabd343c53372e4a013c50754
Author: Gautier DI FOLCO <gd...@linagora.com>
AuthorDate: Wed May 13 10:35:37 2020 +0200

    JAMES-3179 Migrate ImapFeaturesTest to JUnit 5
---
 .../org/apache/james/mpt/api/ImapFeaturesTest.java | 47 ++++++++++++----------
 1 file changed, 25 insertions(+), 22 deletions(-)

diff --git a/mpt/core/src/test/java/org/apache/james/mpt/api/ImapFeaturesTest.java b/mpt/core/src/test/java/org/apache/james/mpt/api/ImapFeaturesTest.java
index 8411f84..fb43eb9 100644
--- a/mpt/core/src/test/java/org/apache/james/mpt/api/ImapFeaturesTest.java
+++ b/mpt/core/src/test/java/org/apache/james/mpt/api/ImapFeaturesTest.java
@@ -19,68 +19,71 @@
 package org.apache.james.mpt.api;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.james.mpt.api.ImapFeatures.Feature;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class ImapFeaturesTest {
 
     @Test
-    public void supportedFeaturesShouldReturnEmptySetWhenNoFeatures() {
+    void supportedFeaturesShouldReturnEmptySetWhenNoFeatures() {
         assertThat(ImapFeatures.of().supportedFeatures()).isEmpty();
     }
 
     @Test
-    public void supportedFeaturesShouldReturnNamespaceInSetWhenNamespaceSupported() {
+    void supportedFeaturesShouldReturnNamespaceInSetWhenNamespaceSupported() {
         assertThat(ImapFeatures.of(Feature.NAMESPACE_SUPPORT).supportedFeatures()).containsExactly(Feature.NAMESPACE_SUPPORT);
     }
 
     @Test
-    public void supportsShouldReturnFalseOnNamespaceWhenNamespaceIsNotSupported() {
+    void supportsShouldReturnFalseOnNamespaceWhenNamespaceIsNotSupported() {
         assertThat(ImapFeatures.of().supports(Feature.NAMESPACE_SUPPORT)).isFalse();
     }
 
     @Test
-    public void supportsShouldReturnTrueOnNamespaceWhenNamespaceIsSupported() {
+    void supportsShouldReturnTrueOnNamespaceWhenNamespaceIsSupported() {
         assertThat(ImapFeatures.of(Feature.NAMESPACE_SUPPORT).supports(Feature.NAMESPACE_SUPPORT)).isTrue();
     }
 
     @Test
-    public void supportsShouldReturnTrueOnDuplicateNamespaceEntryWhenNamespaceIsSupported() {
+    void supportsShouldReturnTrueOnDuplicateNamespaceEntryWhenNamespaceIsSupported() {
         assertThat(ImapFeatures.of(Feature.NAMESPACE_SUPPORT).supports(Feature.NAMESPACE_SUPPORT, Feature.NAMESPACE_SUPPORT)).isTrue();
     }
 
     
     @Test
-    public void supportsShouldReturnTrueOnEmptyListWhenNamespaceIsSupported() {
+    void supportsShouldReturnTrueOnEmptyListWhenNamespaceIsSupported() {
         assertThat(ImapFeatures.of(Feature.NAMESPACE_SUPPORT).supports()).isTrue();
     }
 
     @Test
-    public void supportsShouldReturnTrueOnEmptyListWhenNoFeatures() {
+    void supportsShouldReturnTrueOnEmptyListWhenNoFeatures() {
         assertThat(ImapFeatures.of().supports()).isTrue();
     }
 
-    @Test(expected = NullPointerException.class)
-    @SuppressWarnings("CheckReturnValue")
-    public void supportsShouldThrowOnNullFeature() {
-        ImapFeatures.of().supports((Feature)null);
+    @Test
+    void supportsShouldThrowOnNullFeature() {
+        assertThatThrownBy(() -> ImapFeatures.of().supports((Feature)null))
+            .isInstanceOf(NullPointerException.class);
     }
 
-    @Test(expected = NullPointerException.class)
-    @SuppressWarnings("CheckReturnValue")
-    public void supportsShouldThrowOnNullFeatureArray() {
-        ImapFeatures.of().supports((Feature[])null);
+    @Test
+    void supportsShouldThrowOnNullFeatureArray() {
+        assertThatThrownBy(() -> ImapFeatures.of().supports((Feature[])null))
+            .isInstanceOf(NullPointerException.class);
     }
 
     
-    @Test(expected = NullPointerException.class)
-    public void ofShouldThrowOnNullFeature() {
-        ImapFeatures.of((Feature)null);
+    @Test
+    void ofShouldThrowOnNullFeature() {
+        assertThatThrownBy(() -> ImapFeatures.of((Feature)null))
+            .isInstanceOf(NullPointerException.class);
     }
 
-    @Test(expected = NullPointerException.class)
-    public void ofShouldThrowOnNullFeatureArray() {
-        ImapFeatures.of((Feature[])null);
+    @Test
+    void ofShouldThrowOnNullFeatureArray() {
+        assertThatThrownBy(() -> ImapFeatures.of((Feature[])null))
+            .isInstanceOf(NullPointerException.class);
     }
 }


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