You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2020/07/24 20:53:00 UTC

[camel] 18/27: [CAMEL-11807] Upgrade camel-thrift to junit5

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

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

commit 63cfacedecc482b88a883e5c372e8cc7180270c7
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Jul 24 12:03:29 2020 +0200

    [CAMEL-11807] Upgrade camel-thrift to junit5
---
 components/camel-thrift/pom.xml                    |  6 +++---
 .../component/thrift/ThriftConsumerAsyncTest.java  | 16 ++++++++++------
 .../thrift/ThriftConsumerConcurrentTest.java       | 11 +++++++----
 .../thrift/ThriftConsumerSecurityTest.java         | 16 ++++++++++------
 .../component/thrift/ThriftConsumerSyncTest.java   | 16 ++++++++++------
 .../thrift/ThriftConsumerZlibCompressionTest.java  | 16 ++++++++++------
 .../component/thrift/ThriftProducerAsyncTest.java  |  9 +++++++--
 .../component/thrift/ThriftProducerBaseTest.java   | 10 +++++-----
 .../thrift/ThriftProducerSecurityTest.java         | 22 ++++++++++++++--------
 .../component/thrift/ThriftProducerSyncTest.java   | 12 +++++++++---
 .../thrift/ThriftProducerZlibCompressionTest.java  | 17 +++++++++++------
 .../thrift/local/ThriftThreadPoolServerTest.java   | 14 ++++++++------
 .../thrift/ThriftMarshalAndUnmarshalJsonTest.java  |  6 ++++--
 .../ThriftMarshalAndUnmarshalSpringTest.java       | 10 +++++++---
 .../thrift/ThriftMarshalAndUnmarshalTest.java      | 10 +++++++---
 15 files changed, 122 insertions(+), 69 deletions(-)

diff --git a/components/camel-thrift/pom.xml b/components/camel-thrift/pom.xml
index d0747f3..571145e 100644
--- a/components/camel-thrift/pom.xml
+++ b/components/camel-thrift/pom.xml
@@ -61,12 +61,12 @@
         <!-- testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-spring</artifactId>
+            <artifactId>camel-test-spring-junit5</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerAsyncTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerAsyncTest.java
index 5fc1b58..1dea8f6 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerAsyncTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerAsyncTest.java
@@ -30,19 +30,23 @@ import org.apache.camel.component.thrift.generated.Calculator;
 import org.apache.camel.component.thrift.generated.Operation;
 import org.apache.camel.component.thrift.generated.Work;
 import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
 import org.apache.thrift.async.AsyncMethodCallback;
 import org.apache.thrift.async.TAsyncClientManager;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.transport.TNonblockingSocket;
 import org.apache.thrift.transport.TNonblockingTransport;
 import org.apache.thrift.transport.TTransportException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 public class ThriftConsumerAsyncTest extends CamelTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(ThriftConsumerAsyncTest.class);
     private static final int THRIFT_TEST_PORT = AvailablePortFinder.getNextAvailable();
@@ -57,7 +61,7 @@ public class ThriftConsumerAsyncTest extends CamelTestSupport {
     private int allTypesResult;
     private Work echoResult;
 
-    @Before
+    @BeforeEach
     public void startThriftClient() throws IOException, TTransportException {
         if (transport == null) {
             LOG.info("Connecting to the Thrift server on port: {}", THRIFT_TEST_PORT);
@@ -66,7 +70,7 @@ public class ThriftConsumerAsyncTest extends CamelTestSupport {
         }
     }
 
-    @After
+    @AfterEach
     public void stopThriftClient() throws Exception {
         if (transport != null) {
             transport.close();
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerConcurrentTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerConcurrentTest.java
index 5de4e51..cf17850 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerConcurrentTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerConcurrentTest.java
@@ -28,7 +28,7 @@ import org.apache.camel.component.thrift.generated.Calculator;
 import org.apache.camel.component.thrift.generated.Operation;
 import org.apache.camel.component.thrift.generated.Work;
 import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
 import org.apache.thrift.TException;
 import org.apache.thrift.async.AsyncMethodCallback;
 import org.apache.thrift.async.TAsyncClientManager;
@@ -40,10 +40,13 @@ import org.apache.thrift.transport.TNonblockingTransport;
 import org.apache.thrift.transport.TSocket;
 import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.transport.TTransportException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
 public class ThriftConsumerConcurrentTest extends CamelTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(ThriftConsumerConcurrentTest.class);
 
@@ -83,7 +86,7 @@ public class ThriftConsumerConcurrentTest extends CamelTestSupport {
                     LOG.info("Exception", e);
                 }
                 
-                assertNotNull("instanceId = " + instanceId, calculateResponse);
+                assertNotNull(calculateResponse, "instanceId = " + instanceId);
                 assertEquals(instanceId * THRIFT_TEST_NUM1, calculateResponse);
 
                 transport.close();
@@ -114,7 +117,7 @@ public class ThriftConsumerConcurrentTest extends CamelTestSupport {
                 latch.await(5, TimeUnit.SECONDS);
                 
                 int calculateResponse = calculateCallback.getCalculateResponse();
-                assertNotNull("instanceId = " + instanceId, calculateResponse);
+                assertNotNull(calculateResponse, "instanceId = " + instanceId);
                 assertEquals(instanceId * THRIFT_TEST_NUM1, calculateResponse);
 
                 transport.close();
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSecurityTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSecurityTest.java
index afa9179..6e7308c 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSecurityTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSecurityTest.java
@@ -29,18 +29,22 @@ import org.apache.camel.support.jsse.KeyManagersParameters;
 import org.apache.camel.support.jsse.KeyStoreParameters;
 import org.apache.camel.support.jsse.SSLContextParameters;
 import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.transport.TSSLTransportFactory;
 import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.transport.TTransportException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 public class ThriftConsumerSecurityTest extends CamelTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(ThriftConsumerSecurityTest.class);
     private static final int THRIFT_TEST_PORT = AvailablePortFinder.getNextAvailable();
@@ -56,7 +60,7 @@ public class ThriftConsumerSecurityTest extends CamelTestSupport {
     private TProtocol protocol;
     private TTransport transport;
     
-    @Before
+    @BeforeEach
     public void startThriftSecureClient() throws IOException, TTransportException {
         if (transport == null) {
             LOG.info("Connecting to the secured Thrift server on port: {}", THRIFT_TEST_PORT);
@@ -72,7 +76,7 @@ public class ThriftConsumerSecurityTest extends CamelTestSupport {
         }
     }
 
-    @After
+    @AfterEach
     public void stopThriftClient() throws Exception {
         if (transport != null) {
             transport.close();
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSyncTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSyncTest.java
index c68d47b..fb7bfcb 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSyncTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSyncTest.java
@@ -24,19 +24,23 @@ import org.apache.camel.component.thrift.generated.Calculator;
 import org.apache.camel.component.thrift.generated.Operation;
 import org.apache.camel.component.thrift.generated.Work;
 import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.transport.TFramedTransport;
 import org.apache.thrift.transport.TSocket;
 import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.transport.TTransportException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 public class ThriftConsumerSyncTest extends CamelTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(ThriftConsumerSyncTest.class);
     private static final int THRIFT_TEST_PORT = AvailablePortFinder.getNextAvailable();
@@ -47,7 +51,7 @@ public class ThriftConsumerSyncTest extends CamelTestSupport {
     private TProtocol protocol;
     private TTransport transport;
     
-    @Before
+    @BeforeEach
     public void startThriftClient() throws IOException, TTransportException {
         if (transport == null) {
             LOG.info("Connecting to the Thrift server on port: {}", THRIFT_TEST_PORT);
@@ -58,7 +62,7 @@ public class ThriftConsumerSyncTest extends CamelTestSupport {
         }
     }
 
-    @After
+    @AfterEach
     public void stopThriftClient() throws Exception {
         if (transport != null) {
             transport.close();
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerZlibCompressionTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerZlibCompressionTest.java
index 12c3859..b2040c3 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerZlibCompressionTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerZlibCompressionTest.java
@@ -24,19 +24,23 @@ import org.apache.camel.component.thrift.generated.Calculator;
 import org.apache.camel.component.thrift.generated.Operation;
 import org.apache.camel.component.thrift.generated.Work;
 import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.transport.TSocket;
 import org.apache.thrift.transport.TTransport;
 import org.apache.thrift.transport.TTransportException;
 import org.apache.thrift.transport.TZlibTransport;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 public class ThriftConsumerZlibCompressionTest extends CamelTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(ThriftConsumerZlibCompressionTest.class);
     private static final int THRIFT_TEST_PORT = AvailablePortFinder.getNextAvailable();
@@ -49,7 +53,7 @@ public class ThriftConsumerZlibCompressionTest extends CamelTestSupport {
     private TProtocol protocol;
     private TTransport transport;
     
-    @Before
+    @BeforeEach
     public void startThriftZlibClient() throws IOException, TTransportException {
         if (transport == null) {
             LOG.info("Connecting to the Thrift server with zlib compression on port: {}", THRIFT_TEST_PORT);
@@ -62,7 +66,7 @@ public class ThriftConsumerZlibCompressionTest extends CamelTestSupport {
         }
     }
 
-    @After
+    @AfterEach
     public void stopThriftClient() throws Exception {
         if (transport != null) {
             transport.close();
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerAsyncTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerAsyncTest.java
index fd89b8a..118879e 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerAsyncTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerAsyncTest.java
@@ -30,10 +30,15 @@ import org.apache.camel.component.thrift.generated.InvalidOperation;
 import org.apache.camel.component.thrift.generated.Operation;
 import org.apache.camel.component.thrift.generated.Work;
 import org.apache.camel.support.SynchronizationAdapter;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 public class ThriftProducerAsyncTest extends ThriftProducerBaseTest {
     private static final Logger LOG = LoggerFactory.getLogger(ThriftProducerAsyncTest.class);
 
@@ -130,7 +135,7 @@ public class ThriftProducerAsyncTest extends ThriftProducerBaseTest {
         });
         latch.await(5, TimeUnit.SECONDS);
         
-        assertTrue("Get an InvalidOperation exception", responseBody instanceof InvalidOperation);
+        assertTrue(responseBody instanceof InvalidOperation, "Get an InvalidOperation exception");
  
     }
     
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerBaseTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerBaseTest.java
index 14b9e5f..f65b948 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerBaseTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerBaseTest.java
@@ -21,13 +21,13 @@ import java.io.IOException;
 import org.apache.camel.component.thrift.generated.Calculator;
 import org.apache.camel.component.thrift.impl.CalculatorSyncServerImpl;
 import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
 import org.apache.thrift.server.THsHaServer;
 import org.apache.thrift.server.THsHaServer.Args;
 import org.apache.thrift.server.TServer;
 import org.apache.thrift.transport.TNonblockingServerSocket;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -42,7 +42,7 @@ public class ThriftProducerBaseTest extends CamelTestSupport {
     private static TNonblockingServerSocket serverTransport;
     private static TServer server;
 
-    @BeforeClass
+    @BeforeAll
     @SuppressWarnings({"unchecked", "rawtypes"})
     public static void startThriftServer() throws Exception {
         processor = new Calculator.Processor(new CalculatorSyncServerImpl());
@@ -57,7 +57,7 @@ public class ThriftProducerBaseTest extends CamelTestSupport {
         new Thread(simple).start();
     }
 
-    @AfterClass
+    @AfterAll
     public static void stopThriftServer() throws IOException {
         if (server != null) {
             server.stop();
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSecurityTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSecurityTest.java
index c9b4114..4eeac59 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSecurityTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSecurityTest.java
@@ -37,17 +37,23 @@ import org.apache.camel.support.jsse.KeyStoreParameters;
 import org.apache.camel.support.jsse.SSLContextParameters;
 import org.apache.camel.support.jsse.TrustManagersParameters;
 import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
 import org.apache.thrift.server.TServer;
 import org.apache.thrift.server.TThreadPoolServer;
 import org.apache.thrift.transport.TSSLTransportFactory;
 import org.apache.thrift.transport.TServerSocket;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
 public class ThriftProducerSecurityTest extends CamelTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(ThriftProducerSecurityTest.class);
     
@@ -65,7 +71,7 @@ public class ThriftProducerSecurityTest extends CamelTestSupport {
     private static final String SECURITY_STORE_PASSWORD = "camelinaction";
     private static final int THRIFT_CLIENT_TIMEOUT = 2000;
     
-    @BeforeClass
+    @BeforeAll
     @SuppressWarnings({"unchecked", "rawtypes"})
     public static void startThriftServer() throws Exception {
         processor = new Calculator.Processor(new CalculatorSyncServerImpl());
@@ -87,7 +93,7 @@ public class ThriftProducerSecurityTest extends CamelTestSupport {
         new Thread(simple).start();
     }
 
-    @AfterClass
+    @AfterAll
     public static void stopThriftServer() throws IOException {
         if (server != null) {
             server.stop();
@@ -145,8 +151,8 @@ public class ThriftProducerSecurityTest extends CamelTestSupport {
             template.requestBody("direct:thrift-secured-calculate", requestBody);
             fail("Expect the exception here");
         } catch (Exception ex) {
-            assertTrue("Expect CamelExecutionException", ex instanceof CamelExecutionException);
-            assertTrue("Get an InvalidOperation exception", ex.getCause() instanceof InvalidOperation);
+            assertTrue(ex instanceof CamelExecutionException, "Expect CamelExecutionException");
+            assertTrue(ex.getCause() instanceof InvalidOperation, "Get an InvalidOperation exception");
         }
     }
     
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSyncTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSyncTest.java
index 96a4ac7..c48b497 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSyncTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSyncTest.java
@@ -27,10 +27,16 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.thrift.generated.InvalidOperation;
 import org.apache.camel.component.thrift.generated.Operation;
 import org.apache.camel.component.thrift.generated.Work;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
 public class ThriftProducerSyncTest extends ThriftProducerBaseTest {
     private static final Logger LOG = LoggerFactory.getLogger(ThriftProducerSyncTest.class);
 
@@ -82,8 +88,8 @@ public class ThriftProducerSyncTest extends ThriftProducerBaseTest {
             template.requestBody("direct:thrift-calculate", requestBody);
             fail("Expect the exception here");
         } catch (Exception ex) {
-            assertTrue("Expect CamelExecutionException", ex instanceof CamelExecutionException);
-            assertTrue("Get an InvalidOperation exception", ex.getCause() instanceof InvalidOperation);
+            assertTrue(ex instanceof CamelExecutionException, "Expect CamelExecutionException");
+            assertTrue(ex.getCause() instanceof InvalidOperation, "Get an InvalidOperation exception");
         }
     }
     
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerZlibCompressionTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerZlibCompressionTest.java
index 9afc74b..17d68cd 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerZlibCompressionTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerZlibCompressionTest.java
@@ -28,18 +28,23 @@ import org.apache.camel.component.thrift.generated.Operation;
 import org.apache.camel.component.thrift.generated.Work;
 import org.apache.camel.component.thrift.impl.CalculatorSyncServerImpl;
 import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.server.TServer;
 import org.apache.thrift.server.TThreadPoolServer;
 import org.apache.thrift.transport.TServerSocket;
 import org.apache.thrift.transport.TZlibTransport;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 public class ThriftProducerZlibCompressionTest extends CamelTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(ThriftProducerZlibCompressionTest.class);
     
@@ -53,7 +58,7 @@ public class ThriftProducerZlibCompressionTest extends CamelTestSupport {
     private static final int THRIFT_TEST_NUM2 = 13;
     private static final int THRIFT_CLIENT_TIMEOUT = 2000;
     
-    @BeforeClass
+    @BeforeAll
     @SuppressWarnings({"unchecked", "rawtypes"})
     public static void startThriftServer() throws Exception {
         processor = new Calculator.Processor(new CalculatorSyncServerImpl());
@@ -74,7 +79,7 @@ public class ThriftProducerZlibCompressionTest extends CamelTestSupport {
         new Thread(simple).start();
     }
 
-    @AfterClass
+    @AfterAll
     public static void stopThriftServer() throws IOException {
         if (server != null) {
             server.stop();
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/local/ThriftThreadPoolServerTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/local/ThriftThreadPoolServerTest.java
index 469a2de..3b17d2a 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/local/ThriftThreadPoolServerTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/local/ThriftThreadPoolServerTest.java
@@ -24,7 +24,7 @@ import org.apache.camel.component.thrift.generated.Calculator;
 import org.apache.camel.component.thrift.impl.CalculatorSyncServerImpl;
 import org.apache.camel.component.thrift.server.ThriftThreadPoolServer;
 import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
 import org.apache.thrift.TException;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TProtocol;
@@ -32,12 +32,14 @@ import org.apache.thrift.server.TServer;
 import org.apache.thrift.transport.TSSLTransportFactory;
 import org.apache.thrift.transport.TServerSocket;
 import org.apache.thrift.transport.TTransport;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 /**
  * TBD
  */
@@ -60,7 +62,7 @@ public class ThriftThreadPoolServerTest extends CamelTestSupport {
     @SuppressWarnings({"rawtypes"})
     private static Calculator.Processor processor;
 
-    @Before
+    @BeforeEach
     @SuppressWarnings({"unchecked", "rawtypes"})
     public void startThriftServer() throws Exception {
         processor = new Calculator.Processor(new CalculatorSyncServerImpl());
@@ -81,7 +83,7 @@ public class ThriftThreadPoolServerTest extends CamelTestSupport {
         LOG.info("Thrift secured server started on port: {}", THRIFT_TEST_PORT);
     }
 
-    @After
+    @AfterEach
     public void stopThriftServer() throws IOException {
         if (server != null) {
             server.stop();
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/ThriftMarshalAndUnmarshalJsonTest.java b/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/ThriftMarshalAndUnmarshalJsonTest.java
index 756ae21..025c899 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/ThriftMarshalAndUnmarshalJsonTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/ThriftMarshalAndUnmarshalJsonTest.java
@@ -21,8 +21,10 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.dataformat.thrift.generated.Operation;
 import org.apache.camel.dataformat.thrift.generated.Work;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class ThriftMarshalAndUnmarshalJsonTest extends CamelTestSupport {
     
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/ThriftMarshalAndUnmarshalSpringTest.java b/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/ThriftMarshalAndUnmarshalSpringTest.java
index f34b935..1feb829 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/ThriftMarshalAndUnmarshalSpringTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/ThriftMarshalAndUnmarshalSpringTest.java
@@ -22,10 +22,14 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.dataformat.thrift.generated.Operation;
 import org.apache.camel.dataformat.thrift.generated.Work;
-import org.apache.camel.test.spring.CamelSpringTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.spring.junit5.CamelSpringTestSupport;
+import org.junit.jupiter.api.Test;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
 public class ThriftMarshalAndUnmarshalSpringTest extends CamelSpringTestSupport {
     private static final String WORK_TEST_COMMENT = "This is a test thrift data";
     private static final int WORK_TEST_NUM1 = 1;
@@ -63,7 +67,7 @@ public class ThriftMarshalAndUnmarshalSpringTest extends CamelSpringTestSupport
             });
             fail("Expect the exception here");
         } catch (Exception ex) {
-            assertTrue("Expect FailedToCreateRouteException", ex instanceof FailedToCreateRouteException);
+            assertTrue(ex instanceof FailedToCreateRouteException, "Expect FailedToCreateRouteException");
         }
     }
 
diff --git a/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/ThriftMarshalAndUnmarshalTest.java b/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/ThriftMarshalAndUnmarshalTest.java
index f5da95c..fcee951 100644
--- a/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/ThriftMarshalAndUnmarshalTest.java
+++ b/components/camel-thrift/src/test/java/org/apache/camel/dataformat/thrift/ThriftMarshalAndUnmarshalTest.java
@@ -22,8 +22,12 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.dataformat.thrift.generated.Operation;
 import org.apache.camel.dataformat.thrift.generated.Work;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class ThriftMarshalAndUnmarshalTest extends CamelTestSupport {
     private static final String WORK_TEST_COMMENT = "This is a test thrift data";
@@ -57,7 +61,7 @@ public class ThriftMarshalAndUnmarshalTest extends CamelTestSupport {
             });
             fail("Expect the exception here");
         } catch (Exception ex) {
-            assertTrue("Expect FailedToCreateRouteException", ex instanceof FailedToCreateRouteException);
+            assertTrue(ex instanceof FailedToCreateRouteException, "Expect FailedToCreateRouteException");
         }
     }