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 bt...@apache.org on 2019/11/20 07:32:21 UTC

[james-project] 38/41: [Refactoring] Remove exceptions not thrown by methods in test classes in james-server-util module

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

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

commit 128fe638becebb51af7265ce81d181c5a59e8cd0
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Nov 19 17:04:08 2019 +0700

    [Refactoring] Remove exceptions not thrown by methods in test classes in james-server-util module
---
 .../org/apache/james/util/CommutativityCheckerTest.java  | 16 ++++++++--------
 .../java/org/apache/james/util/OptionalUtilsTest.java    |  6 +++---
 .../src/test/java/org/apache/james/util/SizeTest.java    |  2 +-
 .../james/util/concurrency/ConcurrentTestRunnerTest.java |  2 +-
 .../james/util/retry/ExceptionRetryHandlerTest.java      |  2 +-
 5 files changed, 14 insertions(+), 14 deletions(-)

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 d0b9dac..3561c0a 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
@@ -32,7 +32,7 @@ import com.google.common.collect.ImmutableSet;
 
 public class CommutativityCheckerTest {
     @Test
-    void constructorShouldThrowWhenNullValuesToTest() throws Exception {
+    void constructorShouldThrowWhenNullValuesToTest() {
         BinaryOperator<Integer> binaryOperator = (a, b) -> a * a + b;
 
         assertThatThrownBy(() -> new CommutativityChecker<>(null, binaryOperator))
@@ -40,7 +40,7 @@ public class CommutativityCheckerTest {
     }
 
     @Test
-    void constructorShouldThrowWhenEmptyValuesToTest() throws Exception {
+    void constructorShouldThrowWhenEmptyValuesToTest() {
         BinaryOperator<Integer> binaryOperator = (a, b) -> a * a + b;
 
         assertThatThrownBy(() -> new CommutativityChecker<>(ImmutableSet.of(), binaryOperator))
@@ -48,7 +48,7 @@ public class CommutativityCheckerTest {
     }
 
     @Test
-    void constructorShouldThrowWhenSingleValueToTest() throws Exception {
+    void constructorShouldThrowWhenSingleValueToTest() {
         BinaryOperator<Integer> binaryOperator = (a, b) -> a * a + b;
 
         assertThatThrownBy(() -> new CommutativityChecker<>(ImmutableSet.of(0), binaryOperator))
@@ -56,13 +56,13 @@ public class CommutativityCheckerTest {
     }
 
     @Test
-    void constructorShouldThrowWhenNullOperation() throws Exception {
+    void constructorShouldThrowWhenNullOperation() {
         assertThatThrownBy(() -> new CommutativityChecker<>(ImmutableSet.of(0, 1), null))
             .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    void findNonCommutativeInputShouldReturnEmptyWhenCommutativeOperation() throws Exception {
+    void findNonCommutativeInputShouldReturnEmptyWhenCommutativeOperation() {
         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
-    void findNonCommutativeInputShouldReturnDataWhenNonCommutativeOperation() throws Exception {
+    void findNonCommutativeInputShouldReturnDataWhenNonCommutativeOperation() {
         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
-    void findNonCommutativeInputShouldNotReturnStableValues() throws Exception {
+    void findNonCommutativeInputShouldNotReturnStableValues() {
         Set<Integer> integers = ImmutableSet.of(0, 1, 2);
         BinaryOperator<Integer> nonCommutativeOperatorWithStableValues = (a, b) -> a * a + b;
         CommutativityChecker<Integer> commutativityChecker = new CommutativityChecker<>(integers, nonCommutativeOperatorWithStableValues);
@@ -92,7 +92,7 @@ public class CommutativityCheckerTest {
     }
 
     @Test
-    void findNonCommutativeInputShouldReturnEmptyWhenNonCommutativeOperationButOnlyStableValues() throws Exception {
+    void findNonCommutativeInputShouldReturnEmptyWhenNonCommutativeOperationButOnlyStableValues() {
         Set<Integer> stableValues = ImmutableSet.of(0, 1);
         BinaryOperator<Integer> nonCommutativeOperatorWithStableValues = (a, b) -> a * a + b;
         CommutativityChecker<Integer> commutativityChecker = new CommutativityChecker<>(stableValues, nonCommutativeOperatorWithStableValues);
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 98812ab..8d750b9 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
@@ -210,7 +210,7 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    void containsDifferentShouldReturnTrueWhenNullStoreValue() throws Exception {
+    void containsDifferentShouldReturnTrueWhenNullStoreValue() {
         assertThat(OptionalUtils.containsDifferent(Optional.of("any"), null)).isTrue();
     }
 
@@ -220,12 +220,12 @@ public class OptionalUtilsTest {
     }
 
     @Test
-    void containsDifferentShouldReturnFalseWhenSameValue() throws Exception {
+    void containsDifferentShouldReturnFalseWhenSameValue() {
         assertThat(OptionalUtils.containsDifferent(Optional.of("any"), "any")).isFalse();
     }
 
     @Test
-    void containsDifferentShouldReturnTrueWhenDifferentValue() throws Exception {
+    void containsDifferentShouldReturnTrueWhenDifferentValue() {
         assertThat(OptionalUtils.containsDifferent(Optional.of("any"), "other")).isTrue();
     }
 
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 bc73a77..7afdf56 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
@@ -68,7 +68,7 @@ public class SizeTest {
     }
 
     @Test
-    void testWrongNumber() throws Exception {
+    void testWrongNumber() {
         assertThatThrownBy(() -> Size.parse("42RG"))
             .isInstanceOf(NumberFormatException.class);
     }
diff --git a/server/container/util/src/test/java/org/apache/james/util/concurrency/ConcurrentTestRunnerTest.java b/server/container/util/src/test/java/org/apache/james/util/concurrency/ConcurrentTestRunnerTest.java
index 1381694..7a4afc0 100644
--- a/server/container/util/src/test/java/org/apache/james/util/concurrency/ConcurrentTestRunnerTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/concurrency/ConcurrentTestRunnerTest.java
@@ -185,7 +185,7 @@ public class ConcurrentTestRunnerTest {
     }
 
     @Test
-    void assertNoExceptionShouldThrowOnExceptions() throws Exception {
+    void assertNoExceptionShouldThrowOnExceptions() {
         assertThatThrownBy(() ->
                 ConcurrentTestRunner.builder()
                     .operation((threadNumber, step) -> {
diff --git a/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java b/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java
index a61f05f..07ba09d 100644
--- a/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java
@@ -55,7 +55,7 @@ public class ExceptionRetryHandlerTest {
     private RetrySchedule schedule = null;
 
     @BeforeEach
-    void setUp() throws Exception {
+    void setUp() {
         exceptionClasses = new Class<?>[]{Exception.class};
         proxy = new TestRetryingProxy();
         schedule = i -> i;


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