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

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new e8f4aa6  (chores) camel-cm-sms: cleanup test code (#5985)
e8f4aa6 is described below

commit e8f4aa6475d2e83ee91e4f0598340419a4c59072
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Wed Aug 25 12:09:48 2021 +0200

    (chores) camel-cm-sms: cleanup test code (#5985)
    
    - Cleanup/simplify assertions
    - Remove unused exceptions declarations
    - Remove commented code
---
 .../component/cm/test/CMConfigurationTest.java     |  38 +++----
 .../camel/component/cm/test/CMMessageTest.java     | 112 ++++++++++-----------
 .../org/apache/camel/component/cm/test/CMTest.java |  48 ++-------
 .../camel/component/cm/test/SMSMessageTest.java    |  64 ++++++------
 4 files changed, 108 insertions(+), 154 deletions(-)

diff --git 
a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
 
b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
index d688d82..2b008288 100644
--- 
a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
+++ 
b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMConfigurationTest.java
@@ -24,31 +24,21 @@ import javax.validation.Validator;
 
 import org.apache.camel.component.cm.CMConfiguration;
 import org.apache.camel.test.spring.junit5.CamelSpringTest;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
-import org.springframework.util.Assert;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 @CamelSpringTest
 @ContextConfiguration(classes = { ValidatorConfiguration.class })
-// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
-// @DisableJmx(false)
-// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class CMConfigurationTest {
 
     @Autowired
     private Validator validator;
 
-    @BeforeEach
-    public void beforeTest() throws Exception {
-    }
-
-    // @After
-    // public void afterTest() {
-
     @Test
-    public void testNullProductToken() throws Exception {
+    public void testNullProductToken() {
 
         final CMConfiguration configuration = new CMConfiguration();
 
@@ -59,11 +49,11 @@ public class CMConfigurationTest {
         configuration.setTestConnectionOnStartup(false);
 
         final Set<ConstraintViolation<CMConfiguration>> constraintViolations = 
validator.validate(configuration);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testNullDefaultFrom() throws Exception {
+    public void testNullDefaultFrom() {
 
         final CMConfiguration configuration = new CMConfiguration();
 
@@ -75,11 +65,11 @@ public class CMConfigurationTest {
         configuration.setTestConnectionOnStartup(false);
 
         final Set<ConstraintViolation<CMConfiguration>> constraintViolations = 
validator.validate(configuration);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testDefaultFromFieldMaxLength() throws Exception {
+    public void testDefaultFromFieldMaxLength() {
 
         final CMConfiguration configuration = new CMConfiguration();
 
@@ -91,11 +81,11 @@ public class CMConfigurationTest {
         configuration.setTestConnectionOnStartup(false);
 
         final Set<ConstraintViolation<CMConfiguration>> constraintViolations = 
validator.validate(configuration);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testDefaultFromFieldZeroLength() throws Exception {
+    public void testDefaultFromFieldZeroLength() {
 
         final CMConfiguration configuration = new CMConfiguration();
 
@@ -107,11 +97,11 @@ public class CMConfigurationTest {
         configuration.setTestConnectionOnStartup(false);
 
         final Set<ConstraintViolation<CMConfiguration>> constraintViolations = 
validator.validate(configuration);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testMaxNumberOfParts() throws Exception {
+    public void testMaxNumberOfParts() {
 
         final CMConfiguration configuration = new CMConfiguration();
 
@@ -121,11 +111,11 @@ public class CMConfigurationTest {
         configuration.setTestConnectionOnStartup(false);
 
         final Set<ConstraintViolation<CMConfiguration>> constraintViolations = 
validator.validate(configuration);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testMaxNumberOfPartsZero() throws Exception {
+    public void testMaxNumberOfPartsZero() {
 
         final CMConfiguration configuration = new CMConfiguration();
 
@@ -135,6 +125,6 @@ public class CMConfigurationTest {
         configuration.setTestConnectionOnStartup(false);
 
         final Set<ConstraintViolation<CMConfiguration>> constraintViolations = 
validator.validate(configuration);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 }
diff --git 
a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
 
b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
index 397791d..2e7d5c3 100644
--- 
a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
+++ 
b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMMessageTest.java
@@ -24,32 +24,29 @@ import org.apache.camel.test.spring.junit5.CamelSpringTest;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.test.context.ContextConfiguration;
-import org.springframework.util.Assert;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 @CamelSpringTest
 @ContextConfiguration(classes = { ValidatorConfiguration.class })
-// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
-// @DisableJmx(false)
-// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class CMMessageTest {
 
     private final PhoneNumberUtil pnu = PhoneNumberUtil.getInstance();
     private String validNumber;
 
     @BeforeEach
-    public void beforeTest() throws Exception {
+    public void beforeTest() {
         validNumber = pnu.format(pnu.getExampleNumber("ES"), 
PhoneNumberFormat.E164);
     }
 
-    // @After
-    // public void afterTest() {
-
     /*
      * GSM0338
      */
 
     @Test
-    public void testGSM338AndLTMAXGSMMESSAGELENGTH() throws Exception {
+    public void testGSM338AndLTMAXGSMMESSAGELENGTH() {
 
         // 0338 and less than 160 char -> 1 part
 
@@ -61,12 +58,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 1, "Call to getMultiparts() 
should have returned 1");
-        Assert.isTrue(!cmMessage.isUnicode(), "Should not be unicode");
+        assertEquals(1, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 1");
+        assertFalse(cmMessage.isUnicode(), "Should not be unicode");
     }
 
     @Test
-    public void testGSM338AndEQMAXGSMMESSAGELENGTH() throws Exception {
+    public void testGSM338AndEQMAXGSMMESSAGELENGTH() {
         // 0338 and length is exactly 160 -> 1 part
 
         StringBuilder sb = new StringBuilder();
@@ -77,12 +74,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 1, "Call to getMultiparts() 
should have returned 1");
-        Assert.isTrue(!cmMessage.isUnicode(), "Should not be unicode");
+        assertEquals(1, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 1");
+        assertFalse(cmMessage.isUnicode(), "Should not be unicode");
     }
 
     @Test
-    public void testGSM338AndGTMAXGSMMESSAGELENGTH() throws Exception {
+    public void testGSM338AndGTMAXGSMMESSAGELENGTH() {
 
         // 0338 and length is exactly 161 -> 2 part
 
@@ -94,13 +91,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 2, "Call to getMultiparts() 
should have returned 2");
-        Assert.isTrue(!cmMessage.isUnicode(), "Should not be unicode");
+        assertEquals(2, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 2");
+        assertFalse(cmMessage.isUnicode(), "Should not be unicode");
     }
 
     @Test
-    public void testGSM338AndLT2MAXGSMMESSAGELENGTH() throws Exception {
-
+    public void testGSM338AndLT2MAXGSMMESSAGELENGTH() {
         StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (2 * 
CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART - 1); index++) {
             sb.append("a");
@@ -109,12 +105,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 2, "Call to getMultiparts() 
should have returned 2");
-        Assert.isTrue(!cmMessage.isUnicode(), "Should not be unicode");
+        assertEquals(2, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 2");
+        assertFalse(cmMessage.isUnicode(), "Should not be unicode");
     }
 
     @Test
-    public void testGSM338AndEQ2MAXGSMMESSAGELENGTH() throws Exception {
+    public void testGSM338AndEQ2MAXGSMMESSAGELENGTH() {
 
         StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (2 * 
CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
@@ -124,13 +120,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 2, "Call to getMultiparts() 
should have returned 2");
-        Assert.isTrue(!cmMessage.isUnicode(), "Should not be unicode");
+        assertEquals(2, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 2");
+        assertFalse(cmMessage.isUnicode(), "Should not be unicode");
     }
 
     @Test
-    public void testGSM338AndGT2MAXGSMMESSAGELENGTH() throws Exception {
-
+    public void testGSM338AndGT2MAXGSMMESSAGELENGTH() {
         StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (2 * 
CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
             sb.append("a");
@@ -139,13 +134,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 3, "Call to getMultiparts() 
should have returned 3");
-        Assert.isTrue(!cmMessage.isUnicode(), "Should not be unicode");
+        assertEquals(3, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 3");
+        assertFalse(cmMessage.isUnicode(), "Should not be unicode");
     }
 
     @Test
-    public void testGSM338AndEQ8MAXGSMMESSAGELENGTH() throws Exception {
-
+    public void testGSM338AndEQ8MAXGSMMESSAGELENGTH() {
         StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (8 * 
CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART); index++) {
             sb.append("a");
@@ -154,12 +148,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 8, "Call to getMultiparts() 
should have returned 8");
-        Assert.isTrue(!cmMessage.isUnicode(), "Should not be unicode");
+        assertEquals(8, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 8");
+        assertFalse(cmMessage.isUnicode(), "Should not be unicode");
     }
 
     @Test
-    public void testGSM338AndGT8MAXGSMMESSAGELENGTH() throws Exception {
+    public void testGSM338AndGT8MAXGSMMESSAGELENGTH() {
 
         StringBuilder sb = new StringBuilder();
         for (int index = 0; index < (8 * 
CMConstants.MAX_GSM_MESSAGE_LENGTH_PER_PART_IF_MULTIPART + 1); index++) {
@@ -169,8 +163,8 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 8, "Call to getMultiparts() 
should have returned 8");
-        Assert.isTrue(!cmMessage.isUnicode(), "Should not be unicode");
+        assertEquals(8, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 8");
+        assertFalse(cmMessage.isUnicode(), "Should not be unicode");
     }
 
     /*
@@ -178,7 +172,7 @@ public class CMMessageTest {
      */
 
     @Test
-    public void testUnicodeAndLTMAXGSMMESSAGELENGTH() throws Exception {
+    public void testUnicodeAndLTMAXGSMMESSAGELENGTH() {
 
         String ch = "\uF400";
 
@@ -192,12 +186,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 1, "Call to getMultiparts() 
should have returned 1");
-        Assert.isTrue(cmMessage.isUnicode(), "Should have been unicode");
+        assertEquals(1, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 1");
+        assertTrue(cmMessage.isUnicode(), "Should have been unicode");
     }
 
     @Test
-    public void testUnicodeAndEQMAXGSMMESSAGELENGTH() throws Exception {
+    public void testUnicodeAndEQMAXGSMMESSAGELENGTH() {
         // 0338 and length is exactly 160 -> 1 part
 
         String ch = "\uF400";
@@ -210,12 +204,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 1, "Call to getMultiparts() 
should have returned 1");
-        Assert.isTrue(cmMessage.isUnicode(), "Should have been unicode");
+        assertEquals(1, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 1");
+        assertTrue(cmMessage.isUnicode(), "Should have been unicode");
     }
 
     @Test
-    public void testUnicodeAndGTMAXGSMMESSAGELENGTH() throws Exception {
+    public void testUnicodeAndGTMAXGSMMESSAGELENGTH() {
 
         // 0338 and length is exactly 161 -> 2 part
 
@@ -229,12 +223,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 2, "Call to getMultiparts() 
should have returned 2");
-        Assert.isTrue(cmMessage.isUnicode(), "Should have been unicode");
+        assertEquals(2, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 2");
+        assertTrue(cmMessage.isUnicode(), "Should have been unicode");
     }
 
     @Test
-    public void testUnicodeAndLT2MAXGSMMESSAGELENGTH() throws Exception {
+    public void testUnicodeAndLT2MAXGSMMESSAGELENGTH() {
 
         String ch = "\uF400";
 
@@ -246,12 +240,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 2, "Call to getMultiparts() 
should have returned 2");
-        Assert.isTrue(cmMessage.isUnicode(), "Should have been unicode");
+        assertEquals(2, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 2");
+        assertTrue(cmMessage.isUnicode(), "Should have been unicode");
     }
 
     @Test
-    public void testUnicodeAndEQ2MAXGSMMESSAGELENGTH() throws Exception {
+    public void testUnicodeAndEQ2MAXGSMMESSAGELENGTH() {
 
         String ch = "\uF400";
 
@@ -263,12 +257,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 2, "Call to getMultiparts() 
should have returned 2");
-        Assert.isTrue(cmMessage.isUnicode(), "Should have been unicode");
+        assertEquals(2, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 2");
+        assertTrue(cmMessage.isUnicode(), "Should have been unicode");
     }
 
     @Test
-    public void testUnicodeAndGT2MAXGSMMESSAGELENGTH() throws Exception {
+    public void testUnicodeAndGT2MAXGSMMESSAGELENGTH() {
 
         String ch = "\uF400";
 
@@ -280,12 +274,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 3, "Call to getMultiparts() 
should have returned 3");
-        Assert.isTrue(cmMessage.isUnicode(), "Should have been unicode");
+        assertEquals(3, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 3");
+        assertTrue(cmMessage.isUnicode(), "Should have been unicode");
     }
 
     @Test
-    public void testUnicodeAndEQ8MAXGSMMESSAGELENGTH() throws Exception {
+    public void testUnicodeAndEQ8MAXGSMMESSAGELENGTH() {
 
         String ch = "\uF400";
 
@@ -297,12 +291,12 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 8, "Call to getMultiparts() 
should have returned 8");
-        Assert.isTrue(cmMessage.isUnicode(), "Should have been unicode");
+        assertEquals(8, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 8");
+        assertTrue(cmMessage.isUnicode(), "Should have been unicode");
     }
 
     @Test
-    public void testUnicodeAndGT8MAXGSMMESSAGELENGTH() throws Exception {
+    public void testUnicodeAndGT8MAXGSMMESSAGELENGTH() {
 
         String ch = "\uF400";
 
@@ -314,8 +308,8 @@ public class CMMessageTest {
         final CMMessage cmMessage = new CMMessage(validNumber, sb.toString());
         cmMessage.setUnicodeAndMultipart(CMConstants.DEFAULT_MULTIPARTS);
 
-        Assert.isTrue(cmMessage.getMultiparts() == 8, "Call to getMultiparts() 
should have returned 8");
-        Assert.isTrue(cmMessage.isUnicode(), "Should have been unicode");
+        assertEquals(8, cmMessage.getMultiparts(), "Call to getMultiparts() 
should have returned 8");
+        assertTrue(cmMessage.isUnicode(), "Should have been unicode");
     }
 
 }
diff --git 
a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
 
b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
index e498cfc..9c244c3 100644
--- 
a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
+++ 
b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
@@ -60,8 +60,8 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationContext;
 import org.springframework.test.context.ContextConfiguration;
-import org.springframework.util.Assert;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
 @CamelSpringTest
@@ -89,8 +89,6 @@ public class CMTest {
     @EndpointInject("mock:test")
     private MockEndpoint mock;
 
-    // private StopWatch stopWatch = new StopWatch(getClass().getSimpleName());
-
     @BeforeEach
     public void beforeTest() throws Exception {
         mock.reset();
@@ -106,15 +104,6 @@ public class CMTest {
         } catch (Exception e) {
             LOGGER.error("Exception trying to stop de routes", e);
         }
-
-        // Stop all routes
-        // for (Route route : camelContext.getRoutes()) {
-        // try {
-        // camelContext.getRouteController().stopRoute(route.getId());
-        // } catch (Exception e) {
-        // logger.error("Exception trying to stop de routes", e);
-        // }
-        // }
     }
 
     /*
@@ -122,7 +111,7 @@ public class CMTest {
      */
 
     @Test
-    public void testNotRequiredProductToken() throws Throwable {
+    public void testNotRequiredProductToken() {
         String schemedUri
                 = 
"cm-sms://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
 
@@ -131,7 +120,7 @@ public class CMTest {
     }
 
     @Test
-    public void testNotRequiredDefaultFrom() throws Throwable {
+    public void testNotRequiredDefaultFrom() {
         String schemedUri
                 = 
"cm-sms://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&testConnectionOnStartup=true";
 
@@ -140,7 +129,7 @@ public class CMTest {
     }
 
     @Test
-    public void testHostUnavailableException() throws Throwable {
+    public void testHostUnavailableException() throws Exception {
         // 
cm-sms://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
         String schemedUri
                 = 
"cm-sms://dummy.sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
@@ -150,7 +139,7 @@ public class CMTest {
     }
 
     @Test
-    public void testInvalidHostDuplicateScheme() throws Throwable {
+    public void testInvalidHostDuplicateScheme() {
         // 
cm-sms://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
         String schemedUri = "cm-sms://https://demo.com";;
         assertThrows(ResolveEndpointFailedException.class,
@@ -162,14 +151,13 @@ public class CMTest {
      */
 
     @Test
-    public void testNullPayload() throws Throwable {
+    public void testNullPayload() {
         assertThrows(RuntimeException.class,
                 () -> cmProxy.send(null));
     }
 
-    // @DirtiesContext
     @Test
-    public void testAsPartOfARoute() throws Exception {
+    public void testAsPartOfARoute() {
 
         // Body
         final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), 
generateUnicodeMessage(), validNumber, null);
@@ -317,7 +305,7 @@ public class CMTest {
     }
 
     @Test
-    public void testCMEndpointIsForProducing() throws Exception {
+    public void testCMEndpointIsForProducing() {
 
         // Change sending strategy
         CMEndpoint endpoint
@@ -327,17 +315,17 @@ public class CMTest {
     }
 
     @Test
-    public void testCMEndpointGetHost() throws Exception {
+    public void testCMEndpointGetHost() {
 
         // Change sending strategy
         CMEndpoint endpoint
                 = (CMEndpoint) 
camelContext.getEndpoint(applicationContext.getBean(CamelTestConfiguration.class).getUri());
-        
Assert.isTrue(endpoint.getHost().equals(applicationContext.getEnvironment().getRequiredProperty("cm.url")),
+        
assertEquals(applicationContext.getEnvironment().getRequiredProperty("cm.url"), 
endpoint.getHost(),
                 "Endpoint host and environment property do not match");
     }
 
     @Test
-    public void testSendInvalidPayload() throws Exception {
+    public void testSendInvalidPayload() {
 
         // Body
         final SMSMessage smsMessage = new SMSMessage(generateIdAsString(), 
generateGSM0338Message(), null, null);
@@ -348,19 +336,6 @@ public class CMTest {
     /*
      * CMMessages
      */
-
-    // @Test(expected = RuntimeException.class)
-    // public void testSkel() throws Exception {
-
-    // mock.expectedMessageCount(1);
-    //
-    // // Body
-    // final SMSMessage smsMessage = new SMSMessage("Hello CM", validNumber);
-    // cmProxy.send(smsMessage);
-    //
-    // mock.assertIsSatisfied();
-    // }
-
     private String generateUnicodeMessage() {
         String ch = "\uF400";
         return generateRandomLengthMessageByChar(ch);
@@ -381,7 +356,6 @@ public class CMTest {
         return sb.toString();
     }
 
-    //
     private String generateIdAsString() {
         return new BigInteger(130, random).toString(32);
     }
diff --git 
a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
 
b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
index 30950a6..54d8b75 100644
--- 
a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
+++ 
b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/SMSMessageTest.java
@@ -31,13 +31,12 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.test.context.ContextConfiguration;
-import org.springframework.util.Assert;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 @CamelSpringTest
 @ContextConfiguration(classes = { ValidatorConfiguration.class })
-// @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
-// @DisableJmx(false)
-// @FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class SMSMessageTest {
 
     @Autowired
@@ -52,131 +51,128 @@ public class SMSMessageTest {
         validNumber = pnu.format(pnu.getExampleNumber("ES"), 
PhoneNumberFormat.E164);
     }
 
-    // @After
-    // public void afterTest() {
-
     @Test
-    public void testSMSMessageConstructor() throws Throwable {
+    public void testSMSMessageConstructor() {
 
         // Coverage ;)
         SMSMessage message = new SMSMessage(null, null);
-        Assert.isNull(message.getMessage(), "SMS message should be null");
-        Assert.isNull(message.getPhoneNumber(), "Number null have been null");
+        assertNull(message.getMessage(), "SMS message should be null");
+        assertNull(message.getPhoneNumber(), "Number null have been null");
 
         message = new SMSMessage("idAsString", null, null, "MySelf");
-        Assert.isTrue(message.getId().equals("idAsString"), "Unexpected id");
-        Assert.isTrue(message.getFrom().equals("MySelf"), "Unexpected from");
+        assertEquals("idAsString", message.getId(), "Unexpected id");
+        assertEquals("MySelf", message.getFrom(), "Unexpected from");
     }
 
     @Test
-    public void testNullMessageField() throws Exception {
+    public void testNullMessageField() {
 
         final SMSMessage m = new SMSMessage(null, validNumber);
 
         final Set<ConstraintViolation<SMSMessage>> constraintViolations = 
validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testNullPhoneNumber() throws Exception {
+    public void testNullPhoneNumber() {
 
         final SMSMessage m = new SMSMessage("Hello world!", null);
 
         final Set<ConstraintViolation<SMSMessage>> constraintViolations = 
validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testDynamicFromFieldMaxLength() throws Exception {
+    public void testDynamicFromFieldMaxLength() {
 
         String dynamicFrom = "messagelengthgreaterthan12";
 
         final SMSMessage m = new SMSMessage("idAsString", "Hello World", 
validNumber, dynamicFrom);
 
         final Set<ConstraintViolation<SMSMessage>> constraintViolations = 
validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testDynamicFromFieldZeroLength() throws Exception {
+    public void testDynamicFromFieldZeroLength() {
 
         String zeroLengthDynamicFrom = "";
 
         final SMSMessage m = new SMSMessage("idAsString", "Hello World", 
validNumber, zeroLengthDynamicFrom);
 
         final Set<ConstraintViolation<SMSMessage>> constraintViolations = 
validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testIdAsStringMaxLength() throws Exception {
+    public void testIdAsStringMaxLength() {
 
         String idAsString = "thisistheidastringlengthgreaterthan32";
 
         final SMSMessage m = new SMSMessage(idAsString, "Hello World", 
validNumber, "MySelf");
 
         final Set<ConstraintViolation<SMSMessage>> constraintViolations = 
validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testIdAsStringFieldZeroLength() throws Exception {
+    public void testIdAsStringFieldZeroLength() {
 
         String zeroLengthIdAsString = "";
 
         final SMSMessage m = new SMSMessage(zeroLengthIdAsString, "Hello 
World", validNumber, "MySelf");
 
         final Set<ConstraintViolation<SMSMessage>> constraintViolations = 
validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testE164NullNumberIsInValid() throws Exception {
+    public void testE164NullNumberIsInValid() {
 
         final String phoneNumber = null;
         final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
 
         final Set<ConstraintViolation<SMSMessage>> constraintViolations = 
validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testE164IsValid() throws Exception {
+    public void testE164IsValid() {
 
         final SMSMessage m = new SMSMessage("Hello world!", validNumber);
 
         final Set<ConstraintViolation<SMSMessage>> constraintViolations = 
validator.validate(m);
-        Assert.isTrue(0 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(0, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testE164NoPlusSignedNumberIsInvalid() throws Exception {
+    public void testE164NoPlusSignedNumberIsInvalid() {
 
         final String phoneNumber = "34600000000";
         final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
 
         final Set<ConstraintViolation<SMSMessage>> constraintViolations = 
validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testE164NoPlusSignedNumberBut00IsInvalid() throws Exception {
+    public void testE164NoPlusSignedNumberBut00IsInvalid() {
 
         final String phoneNumber = new 
PhoneNumber().setCountryCodeSource(CountryCodeSource.FROM_NUMBER_WITHOUT_PLUS_SIGN)
                 .setNationalNumber(0034600000000).toString();
         final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
 
         final Set<ConstraintViolation<SMSMessage>> constraintViolations = 
validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 
     @Test
-    public void testE164NumberWithPlusSignIsInvalid() throws Exception {
+    public void testE164NumberWithPlusSignIsInvalid() {
 
         final String phoneNumber = "+34 600 00 00 00";
         final SMSMessage m = new SMSMessage("Hello world!", phoneNumber);
 
         final Set<ConstraintViolation<SMSMessage>> constraintViolations = 
validator.validate(m);
-        Assert.isTrue(1 == constraintViolations.size(), "Unexpected number of 
constraint violations");
+        assertEquals(1, constraintViolations.size(), "Unexpected number of 
constraint violations");
     }
 }

Reply via email to