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 f76deb6cea45013edd4d720b898cb7cedb365fbc
Author: Rene Cordier <rcord...@linagora.com>
AuthorDate: Wed Aug 12 15:39:49 2020 +0700

    [Refactoring] Migrate SieveQuotaTest to JUnit5
---
 .../sieve/cassandra/model/SieveQuotaTest.java      | 42 ++++++++++++----------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git 
a/server/data/data-cassandra/src/test/java/org/apache/james/sieve/cassandra/model/SieveQuotaTest.java
 
b/server/data/data-cassandra/src/test/java/org/apache/james/sieve/cassandra/model/SieveQuotaTest.java
index 213add4..99e2a75 100644
--- 
a/server/data/data-cassandra/src/test/java/org/apache/james/sieve/cassandra/model/SieveQuotaTest.java
+++ 
b/server/data/data-cassandra/src/test/java/org/apache/james/sieve/cassandra/model/SieveQuotaTest.java
@@ -19,42 +19,46 @@
 
 package org.apache.james.sieve.cassandra.model;
 
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
 import java.util.Optional;
 
 import org.apache.james.core.quota.QuotaSizeLimit;
 import org.apache.james.sieverepository.api.exception.QuotaExceededException;
-import org.junit.Test;
-
-public class SieveQuotaTest {
+import org.junit.jupiter.api.Test;
 
-    public static final long INVALID_VALUE = -1L;
-    public static final QuotaSizeLimit LIMIT_LOW_VALUE = 
QuotaSizeLimit.size(10L);
-    public static final long SIZE_DIFFERENCE = 20L;
-    public static final int CURRENT_USAGE = 0;
-    public static final QuotaSizeLimit LIMIT_HIGH_VALUE = 
QuotaSizeLimit.size(100L);
+class SieveQuotaTest {
+    static final long INVALID_VALUE = -1L;
+    static final QuotaSizeLimit LIMIT_LOW_VALUE = QuotaSizeLimit.size(10L);
+    static final long SIZE_DIFFERENCE = 20L;
+    static final int CURRENT_USAGE = 0;
+    static final QuotaSizeLimit LIMIT_HIGH_VALUE = QuotaSizeLimit.size(100L);
 
-    @Test(expected = IllegalArgumentException.class)
-    public void sieveQuotaShouldThrowOnNegativeCurrentValue() {
-        new SieveQuota(INVALID_VALUE, Optional.empty());
+    @Test
+    void sieveQuotaShouldThrowOnNegativeCurrentValue() {
+        assertThatThrownBy(() -> new SieveQuota(INVALID_VALUE, 
Optional.empty()))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void sieveQuotaShouldThrowOnNegativeLimitValue() {
-        new SieveQuota(0, Optional.of(QuotaSizeLimit.size(INVALID_VALUE)));
+    @Test
+    void sieveQuotaShouldThrowOnNegativeLimitValue() {
+        assertThatThrownBy(() -> new SieveQuota(0, 
Optional.of(QuotaSizeLimit.size(INVALID_VALUE))))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = QuotaExceededException.class)
-    public void checkOverQuotaUponModificationShouldThrowIfLimitExceeded() 
throws Exception {
-        new SieveQuota(CURRENT_USAGE, 
Optional.of(LIMIT_LOW_VALUE)).checkOverQuotaUponModification(SIZE_DIFFERENCE);
+    @Test
+    void checkOverQuotaUponModificationShouldThrowIfLimitExceeded() {
+        assertThatThrownBy(() -> new SieveQuota(CURRENT_USAGE, 
Optional.of(LIMIT_LOW_VALUE)).checkOverQuotaUponModification(SIZE_DIFFERENCE))
+            .isInstanceOf(QuotaExceededException.class);
     }
 
     @Test
-    public void checkOverQuotaShouldNotThrowWhenNoLimit() throws Exception {
+    void checkOverQuotaShouldNotThrowWhenNoLimit() throws Exception {
         new SieveQuota(CURRENT_USAGE, 
Optional.empty()).checkOverQuotaUponModification(SIZE_DIFFERENCE);
     }
 
     @Test
-    public void 
checkOverQuotaUponModificationShouldNotThrowIfLimitNotExceeded() throws 
Exception {
+    void checkOverQuotaUponModificationShouldNotThrowIfLimitNotExceeded() 
throws Exception {
         new SieveQuota(CURRENT_USAGE, 
Optional.of(LIMIT_HIGH_VALUE)).checkOverQuotaUponModification(SIZE_DIFFERENCE);
     }
 }


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

Reply via email to