[camel] branch CAMEL-13826 updated (603665b -> b286d3d)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[camel] branch CAMEL-13826 updated (603665b -> b286d3d)

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

aldettinger pushed a change to branch CAMEL-13826
in repository https://gitbox.apache.org/repos/asf/camel.git.


 discard 603665b  CAMEL-13826: rough migration of the camel-ahc component. To be polished, squashed and rebased
 discard 4459363  CAMEL-13826: Moved route coverage to a dedicated class
     new 587c3a8  CAMEL-13826: Moved route coverage to a dedicated class
     new b286d3d  CAMEL-13826: Migrated camel-ahc tests to camel-test-junit5

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (603665b)
            \
             N -- N -- N   refs/heads/CAMEL-13826 (b286d3d)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/ahc/AhcProduce500Test.java     |  4 ++--
 .../ahc/AhcProduceTransferExceptionTest.java       |  4 ++--
 .../src/main/docs/test-junit5.adoc                 | 25 ++++++++++++----------
 3 files changed, 18 insertions(+), 15 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[camel] 01/02: CAMEL-13826: Moved route coverage to a dedicated class

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

aldettinger pushed a commit to branch CAMEL-13826
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 587c3a8f97846ea9040a9b2916c37613bce3ee24
Author: aldettinger <[hidden email]>
AuthorDate: Mon Aug 12 17:52:33 2019 +0200

    CAMEL-13826: Moved route coverage to a dedicated class
---
 .../camel/test/CamelRouteCoverageDumper.java       | 190 +++++++++++++++++++++
 .../apache/camel/test/junit5/CamelTestSupport.java | 152 +----------------
 .../RouteProcessorDumpRouteCoverageTest.java       |  20 ++-
 3 files changed, 208 insertions(+), 154 deletions(-)

diff --git a/components/camel-test-junit5/src/main/java/org/apache/camel/test/CamelRouteCoverageDumper.java b/components/camel-test-junit5/src/main/java/org/apache/camel/test/CamelRouteCoverageDumper.java
new file mode 100644
index 0000000..ff3252a
--- /dev/null
+++ b/components/camel-test-junit5/src/main/java/org/apache/camel/test/CamelRouteCoverageDumper.java
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+
+import org.apache.camel.Route;
+import org.apache.camel.api.management.ManagedCamelContext;
+import org.apache.camel.api.management.mbean.ManagedCamelContextMBean;
+import org.apache.camel.api.management.mbean.ManagedProcessorMBean;
+import org.apache.camel.api.management.mbean.ManagedRouteMBean;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.util.IOHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A <code>CamelRouteCoverageDumper</code> instance dumps the route coverage of
+ * a given camel test.
+ */
+public class CamelRouteCoverageDumper {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CamelRouteCoverageDumper.class);
+
+    public void dump(ManagedCamelContextMBean managedCamelContext, ModelCamelContext context, String dumpDir, String dumpFilename, String testClass, String testName,
+                     long testTimeTaken)
+        throws Exception {
+        logCoverageSummary(managedCamelContext, context);
+
+        String routeCoverageAsXml = managedCamelContext.dumpRoutesCoverageAsXml();
+        String combined = "<camelRouteCoverage>\n" + gatherTestDetailsAsXml(testClass, testName, testTimeTaken) + routeCoverageAsXml + "\n</camelRouteCoverage>";
+
+        File dumpFile = new File(dumpDir);
+        // ensure dir exists
+        dumpFile.mkdirs();
+        dumpFile = new File(dumpDir, dumpFilename);
+
+        LOG.info("Dumping route coverage to file: {}", dumpFile);
+        InputStream is = new ByteArrayInputStream(combined.getBytes());
+        OutputStream os = new FileOutputStream(dumpFile, false);
+        IOHelper.copyAndCloseInput(is, os);
+        IOHelper.close(os);
+    }
+
+    /**
+     * Groups all processors from Camel context by route id.
+     */
+    private Map<String, List<ManagedProcessorMBean>> findProcessorsForEachRoute(MBeanServer server, ModelCamelContext context)
+        throws MalformedObjectNameException, MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException {
+        String domain = context.getManagementStrategy().getManagementAgent().getMBeanServerDefaultDomain();
+
+        Map<String, List<ManagedProcessorMBean>> processorsForRoute = new HashMap<>();
+
+        ObjectName processorsObjectName = new ObjectName(domain + ":context=" + context.getManagementName() + ",type=processors,name=*");
+        Set<ObjectName> objectNames = server.queryNames(processorsObjectName, null);
+
+        for (ObjectName objectName : objectNames) {
+            String routeId = server.getAttribute(objectName, "RouteId").toString();
+            String name = objectName.getKeyProperty("name");
+            name = ObjectName.unquote(name);
+
+            ManagedProcessorMBean managedProcessor = context.getExtension(ManagedCamelContext.class).getManagedProcessor(name);
+
+            if (managedProcessor != null) {
+                if (processorsForRoute.get(routeId) == null) {
+                    List<ManagedProcessorMBean> processorsList = new ArrayList<>();
+                    processorsList.add(managedProcessor);
+
+                    processorsForRoute.put(routeId, processorsList);
+                } else {
+                    processorsForRoute.get(routeId).add(managedProcessor);
+                }
+            }
+        }
+
+        // sort processors by position in route definition
+        for (Map.Entry<String, List<ManagedProcessorMBean>> entry : processorsForRoute.entrySet()) {
+            Collections.sort(entry.getValue(), Comparator.comparing(ManagedProcessorMBean::getIndex));
+        }
+
+        return processorsForRoute;
+    }
+
+    /**
+     * Gathers test details as xml.
+     */
+    private String gatherTestDetailsAsXml(String testClass, String testName, long timeTaken) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("<test>\n");
+        sb.append("  <class>").append(testClass).append("</class>\n");
+        sb.append("  <method>").append(testName).append("</method>\n");
+        sb.append("  <time>").append(timeTaken).append("</time>\n");
+        sb.append("</test>\n");
+        return sb.toString();
+    }
+
+    /**
+     * Logs route coverage summary, including which routes are uncovered and
+     * what is the coverage of each processor in each route.
+     */
+    private void logCoverageSummary(ManagedCamelContextMBean managedCamelContext, ModelCamelContext context) throws Exception {
+        StringBuilder builder = new StringBuilder("\nCoverage summary\n");
+
+        int routes = managedCamelContext.getTotalRoutes();
+
+        long contextExchangesTotal = managedCamelContext.getExchangesTotal();
+
+        List<String> uncoveredRoutes = new ArrayList<>();
+
+        StringBuilder routesSummary = new StringBuilder();
+        routesSummary.append("\tProcessor coverage\n");
+
+        MBeanServer server = context.getManagementStrategy().getManagementAgent().getMBeanServer();
+
+        Map<String, List<ManagedProcessorMBean>> processorsForRoute = findProcessorsForEachRoute(server, context);
+
+        // log processor coverage for each route
+        for (Route route : context.getRoutes()) {
+            ManagedRouteMBean managedRoute = context.getExtension(ManagedCamelContext.class).getManagedRoute(route.getId());
+            if (managedRoute.getExchangesTotal() == 0) {
+                uncoveredRoutes.add(route.getId());
+            }
+
+            long routeCoveragePercentage = Math.round((double)managedRoute.getExchangesTotal() / contextExchangesTotal * 100);
+            routesSummary.append("\t\tRoute ").append(route.getId()).append(" total: ").append(managedRoute.getExchangesTotal()).append(" (").append(routeCoveragePercentage)
+                .append("%)\n");
+
+            if (server != null) {
+                List<ManagedProcessorMBean> processors = processorsForRoute.get(route.getId());
+                if (processors != null) {
+                    for (ManagedProcessorMBean managedProcessor : processors) {
+                        String processorId = managedProcessor.getProcessorId();
+                        long processorExchangesTotal = managedProcessor.getExchangesTotal();
+                        long processorCoveragePercentage = Math.round((double)processorExchangesTotal / contextExchangesTotal * 100);
+                        routesSummary.append("\t\t\tProcessor ").append(processorId).append(" total: ").append(processorExchangesTotal).append(" (")
+                            .append(processorCoveragePercentage).append("%)\n");
+                    }
+                }
+            }
+        }
+
+        int used = routes - uncoveredRoutes.size();
+
+        long contextPercentage = Math.round((double)used / routes * 100);
+        builder.append("\tRoute coverage: ").append(used).append(" out of ").append(routes).append(" routes used (").append(contextPercentage).append("%)\n");
+        builder.append("\t\tCamelContext (").append(managedCamelContext.getCamelId()).append(") total: ").append(contextExchangesTotal).append("\n");
+
+        if (uncoveredRoutes.size() > 0) {
+            builder.append("\t\tUncovered routes: ").append(uncoveredRoutes.stream().collect(Collectors.joining(", "))).append("\n");
+        }
+
+        builder.append(routesSummary);
+        LOG.info(builder.toString());
+    }
+
+}
diff --git a/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java b/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java
index c7f24d8..1818a98 100644
--- a/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java
+++ b/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/CamelTestSupport.java
@@ -16,31 +16,12 @@
  */
 package org.apache.camel.test.junit5;
 
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
 import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.stream.Collectors;
-
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ConsumerTemplate;
@@ -55,7 +36,6 @@ import org.apache.camel.NoSuchEndpointException;
 import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
 import org.apache.camel.ProducerTemplate;
-import org.apache.camel.Route;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.Service;
@@ -63,8 +43,6 @@ import org.apache.camel.ServiceStatus;
 import org.apache.camel.api.management.JmxSystemPropertyKeys;
 import org.apache.camel.api.management.ManagedCamelContext;
 import org.apache.camel.api.management.mbean.ManagedCamelContextMBean;
-import org.apache.camel.api.management.mbean.ManagedProcessorMBean;
-import org.apache.camel.api.management.mbean.ManagedRouteMBean;
 import org.apache.camel.builder.AdviceWithRouteBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -81,7 +59,7 @@ import org.apache.camel.spi.CamelBeanPostProcessor;
 import org.apache.camel.spi.Language;
 import org.apache.camel.spi.Registry;
 import org.apache.camel.support.EndpointHelper;
-import org.apache.camel.util.IOHelper;
+import org.apache.camel.test.CamelRouteCoverageDumper;
 import org.apache.camel.util.StopWatch;
 import org.apache.camel.util.StringHelper;
 import org.apache.camel.util.TimeUtils;
@@ -134,6 +112,7 @@ public abstract class CamelTestSupport implements BeforeEachCallback, AfterAllCa
     private static final ThreadLocal<AtomicInteger> TESTS = new ThreadLocal<>();
     private static final ThreadLocal<CamelTestSupport> INSTANCE = new ThreadLocal<>();
     private String currentTestName;
+    private CamelRouteCoverageDumper routeCoverageDumper = new CamelRouteCoverageDumper();
     // CHECKSTYLE:ON
 
     @Override
@@ -554,21 +533,7 @@ public abstract class CamelTestSupport implements BeforeEachCallback, AfterAllCa
                 LOG.warn("Cannot dump route coverage to file as JMX is not enabled. "
                          + "Add camel-management-impl JAR as dependency and/or override useJmx() method to enable JMX in the unit test classes.");
             } else {
-                logCoverageSummary(managedCamelContext);
-
-                String xml = managedCamelContext.dumpRoutesCoverageAsXml();
-                String combined = "<camelRouteCoverage>\n" + gatherTestDetailsAsXml() + xml + "\n</camelRouteCoverage>";
-
-                File file = new File(dir);
-                // ensure dir exists
-                file.mkdirs();
-                file = new File(dir, name);
-
-                LOG.info("Dumping route coverage to file: {}", file);
-                InputStream is = new ByteArrayInputStream(combined.getBytes());
-                OutputStream os = new FileOutputStream(file, false);
-                IOHelper.copyAndCloseInput(is, os);
-                IOHelper.close(os);
+                routeCoverageDumper.dump(managedCamelContext, context, dir, name, getClass().getName(), currentTestName, timeTaken());
             }
         }
         LOG.info("********************************************************************************");
@@ -618,117 +583,6 @@ public abstract class CamelTestSupport implements BeforeEachCallback, AfterAllCa
     }
 
     /**
-     * Logs route coverage summary: - which routes are uncovered - what is the
-     * coverage of each processor in each route
-     */
-    private void logCoverageSummary(ManagedCamelContextMBean managedCamelContext) throws Exception {
-        StringBuilder builder = new StringBuilder("\nCoverage summary\n");
-
-        int routes = managedCamelContext.getTotalRoutes();
-
-        long contextExchangesTotal = managedCamelContext.getExchangesTotal();
-
-        List<String> uncoveredRoutes = new ArrayList<>();
-
-        StringBuilder routesSummary = new StringBuilder();
-        routesSummary.append("\tProcessor coverage\n");
-
-        MBeanServer server = context.getManagementStrategy().getManagementAgent().getMBeanServer();
-
-        Map<String, List<ManagedProcessorMBean>> processorsForRoute = findProcessorsForEachRoute(server);
-
-        // log processor coverage for each route
-        for (Route route : context.getRoutes()) {
-            ManagedRouteMBean managedRoute = context.getExtension(ManagedCamelContext.class).getManagedRoute(route.getId());
-            if (managedRoute.getExchangesTotal() == 0) {
-                uncoveredRoutes.add(route.getId());
-            }
-
-            long routeCoveragePercentage = Math.round((double)managedRoute.getExchangesTotal() / contextExchangesTotal * 100);
-            routesSummary.append("\t\tRoute ").append(route.getId()).append(" total: ").append(managedRoute.getExchangesTotal()).append(" (").append(routeCoveragePercentage)
-                .append("%)\n");
-
-            if (server != null) {
-                List<ManagedProcessorMBean> processors = processorsForRoute.get(route.getId());
-                if (processors != null) {
-                    for (ManagedProcessorMBean managedProcessor : processors) {
-                        String processorId = managedProcessor.getProcessorId();
-                        long processorExchangesTotal = managedProcessor.getExchangesTotal();
-                        long processorCoveragePercentage = Math.round((double)processorExchangesTotal / contextExchangesTotal * 100);
-                        routesSummary.append("\t\t\tProcessor ").append(processorId).append(" total: ").append(processorExchangesTotal).append(" (")
-                            .append(processorCoveragePercentage).append("%)\n");
-                    }
-                }
-            }
-        }
-
-        int used = routes - uncoveredRoutes.size();
-
-        long contextPercentage = Math.round((double)used / routes * 100);
-        builder.append("\tRoute coverage: ").append(used).append(" out of ").append(routes).append(" routes used (").append(contextPercentage).append("%)\n");
-        builder.append("\t\tCamelContext (").append(managedCamelContext.getCamelId()).append(") total: ").append(contextExchangesTotal).append("\n");
-
-        if (uncoveredRoutes.size() > 0) {
-            builder.append("\t\tUncovered routes: ").append(uncoveredRoutes.stream().collect(Collectors.joining(", "))).append("\n");
-        }
-
-        builder.append(routesSummary);
-        LOG.info(builder.toString());
-    }
-
-    /**
-     * Groups all processors from Camel context by route id
-     */
-    private Map<String, List<ManagedProcessorMBean>> findProcessorsForEachRoute(MBeanServer server)
-        throws MalformedObjectNameException, MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException {
-        String domain = context.getManagementStrategy().getManagementAgent().getMBeanServerDefaultDomain();
-
-        Map<String, List<ManagedProcessorMBean>> processorsForRoute = new HashMap<>();
-
-        ObjectName processorsObjectName = new ObjectName(domain + ":context=" + context.getManagementName() + ",type=processors,name=*");
-        Set<ObjectName> objectNames = server.queryNames(processorsObjectName, null);
-
-        for (ObjectName objectName : objectNames) {
-            String routeId = server.getAttribute(objectName, "RouteId").toString();
-            String name = objectName.getKeyProperty("name");
-            name = ObjectName.unquote(name);
-
-            ManagedProcessorMBean managedProcessor = context.getExtension(ManagedCamelContext.class).getManagedProcessor(name);
-
-            if (managedProcessor != null) {
-                if (processorsForRoute.get(routeId) == null) {
-                    List<ManagedProcessorMBean> processorsList = new ArrayList<>();
-                    processorsList.add(managedProcessor);
-
-                    processorsForRoute.put(routeId, processorsList);
-                } else {
-                    processorsForRoute.get(routeId).add(managedProcessor);
-                }
-            }
-        }
-
-        // sort processors by position in route definition
-        for (Map.Entry<String, List<ManagedProcessorMBean>> entry : processorsForRoute.entrySet()) {
-            Collections.sort(entry.getValue(), Comparator.comparing(ManagedProcessorMBean::getIndex));
-        }
-
-        return processorsForRoute;
-    }
-
-    /**
-     * Gathers test details as xml
-     */
-    private String gatherTestDetailsAsXml() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("<test>\n");
-        sb.append("  <class>").append(getClass().getName()).append("</class>\n");
-        sb.append("  <method>").append(currentTestName).append("</method>\n");
-        sb.append("  <time>").append(timeTaken()).append("</time>\n");
-        sb.append("</test>\n");
-        return sb.toString();
-    }
-
-    /**
      * Returns the timeout to use when shutting down (unit in seconds).
      * <p/>
      * Will default use 10 seconds.
diff --git a/components/camel-test-junit5/src/test/java/org/apache/camel/test/junit5/patterns/RouteProcessorDumpRouteCoverageTest.java b/components/camel-test-junit5/src/test/java/org/apache/camel/test/junit5/patterns/RouteProcessorDumpRouteCoverageTest.java
index b97959c..e5a99e0 100644
--- a/components/camel-test-junit5/src/test/java/org/apache/camel/test/junit5/patterns/RouteProcessorDumpRouteCoverageTest.java
+++ b/components/camel-test-junit5/src/test/java/org/apache/camel/test/junit5/patterns/RouteProcessorDumpRouteCoverageTest.java
@@ -19,11 +19,14 @@ package org.apache.camel.test.junit5.patterns;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.test.junit5.CamelTestSupport;
-import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.TestReporter;
 
 import static org.apache.camel.test.junit5.TestSupport.assertFileExists;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 public class RouteProcessorDumpRouteCoverageTest extends CamelTestSupport {
 
@@ -38,12 +41,19 @@ public class RouteProcessorDumpRouteCoverageTest extends CamelTestSupport {
         assertEquals("Bye World", out);
     }
 
-    @Override
-    @AfterEach
-    public void tearDown() throws Exception {
-        super.tearDown();
+    @Test
+    public void testProcessorJunit5WithTestParameterInjection(TestInfo info, TestReporter testReporter) throws Exception {
+        assertNotNull(info);
+        assertNotNull(testReporter);
+        String out = template.requestBody("direct:start", "Hello World", String.class);
+        assertEquals("Bye World", out);
+    }
+
+    @AfterAll
+    public static void checkDumpFilesCreatedAfterTests() {
         // should create that file when test is done
         assertFileExists("target/camel-route-coverage/RouteProcessorDumpRouteCoverageTest-testProcessorJunit5.xml");
+        assertFileExists("target/camel-route-coverage/RouteProcessorDumpRouteCoverageTest-testProcessorJunit5WithTestParameterInjection.xml");
     }
 
     @Override

Reply | Threaded
Open this post in threaded view
|

[camel] 02/02: CAMEL-13826: Migrated camel-ahc tests to camel-test-junit5

aldettinger
In reply to this post by aldettinger
This is an automated email from the ASF dual-hosted git repository.

aldettinger pushed a commit to branch CAMEL-13826
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b286d3dedb1a2cb37dda3824f754ffd881e03ebf
Author: aldettinger <[hidden email]>
AuthorDate: Tue Aug 13 16:09:14 2019 +0200

    CAMEL-13826: Migrated camel-ahc tests to camel-test-junit5
---
 components/camel-ahc/pom.xml                       |  7 +++--
 .../ahc/AhcBridgeEndpointPathWithSpacesTest.java   |  6 +++--
 .../camel/component/ahc/AhcBridgeEndpointTest.java | 12 ++++++---
 .../component/ahc/AhcClientConfigRealmUriTest.java |  4 ++-
 .../component/ahc/AhcClientConfigUriTest.java      |  4 ++-
 .../ahc/AhcComponentClientConfigTest.java          |  2 +-
 ...entConfigWithClientConfigUriParametersTest.java |  5 +++-
 .../ahc/AhcComponentCustomClientConfigTest.java    |  2 +-
 .../ahc/AhcComponentNettyClientConfigTest.java     |  2 +-
 .../apache/camel/component/ahc/AhcGoogleTest.java  |  8 +++---
 .../ahc/AhcOperationFailedExceptionTest.java       |  4 +--
 .../camel/component/ahc/AhcProduce500Test.java     |  7 ++++-
 .../component/ahc/AhcProduceClientConfigTest.java  |  2 +-
 ...entConfigWithClientConfigUriParametersTest.java |  5 +++-
 .../component/ahc/AhcProduceGetHeadersTest.java    |  2 +-
 .../ahc/AhcProduceGetNoSlashInUriTest.java         |  2 +-
 .../camel/component/ahc/AhcProduceGetTest.java     |  4 ++-
 .../AhcProduceNoThrowExceptionOnFailureTest.java   |  2 +-
 .../component/ahc/AhcProducePostDoWhileTest.java   |  2 +-
 .../component/ahc/AhcProducePostHeadersTest.java   |  2 +-
 .../camel/component/ahc/AhcProducePostTest.java    |  4 ++-
 .../ahc/AhcProduceTransferExceptionTest.java       |  7 ++++-
 ...hcProduceWithClientConfigUriParametersTest.java |  2 +-
 .../ahc/AhcProducerConnectionCloseHeadersTest.java |  2 +-
 .../component/ahc/AhcProducerSessionTest.java      |  2 +-
 .../AhcProducerTwoParametersWithSameKeyTest.java   | 10 +++++---
 .../apache/camel/component/ahc/BaseAhcTest.java    |  6 ++---
 .../camel/component/ahc/HttpEndpointURLTest.java   |  6 +++--
 .../ahc/HttpHeaderFilterStrategyTest.java          | 11 +++++---
 .../ahc/javabody/AhcProduceJavaBodyTest.java       |  8 +++++-
 .../src/main/docs/test-junit5.adoc                 | 30 ++++++++++++++++++++++
 31 files changed, 123 insertions(+), 49 deletions(-)

diff --git a/components/camel-ahc/pom.xml b/components/camel-ahc/pom.xml
index 8395944..18d4d9b 100644
--- a/components/camel-ahc/pom.xml
+++ b/components/camel-ahc/pom.xml
@@ -65,7 +65,7 @@
         <!-- testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test</artifactId>
+            <artifactId>camel-test-junit5</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -78,10 +78,9 @@
             <artifactId>camel-jetty</artifactId>
             <scope>test</scope>
         </dependency>
-
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>java-hamcrest</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcBridgeEndpointPathWithSpacesTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcBridgeEndpointPathWithSpacesTest.java
index a71ddf6..ac4bcde 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcBridgeEndpointPathWithSpacesTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcBridgeEndpointPathWithSpacesTest.java
@@ -21,7 +21,9 @@ import java.io.ByteArrayInputStream;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class AhcBridgeEndpointPathWithSpacesTest extends BaseAhcTest {
 
@@ -32,7 +34,7 @@ public class AhcBridgeEndpointPathWithSpacesTest extends BaseAhcTest {
     public void testBridgeEndpoint() throws Exception {
         String response = template.requestBodyAndHeader("http://localhost:" + port1 + "/test bar/hello",
                 new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "application/xml", String.class);
-        assertEquals("Get a wrong response", "/proxy%20bar/hello", response);
+        assertEquals("/proxy%20bar/hello", response, "Get a wrong response");
     }
 
     @Override
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcBridgeEndpointTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcBridgeEndpointTest.java
index 920d0ae..0a15b63 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcBridgeEndpointTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcBridgeEndpointTest.java
@@ -22,7 +22,11 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+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 AhcBridgeEndpointTest extends BaseAhcTest {
 
@@ -33,16 +37,16 @@ public class AhcBridgeEndpointTest extends BaseAhcTest {
     public void testBridgeEndpoint() throws Exception {
         String response = template.requestBodyAndHeader("http://localhost:" + port1 + "/test/hello",
                 new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "application/xml", String.class);
-        assertEquals("Get a wrong response", "/", response);
+        assertEquals("/", response, "Get a wrong response");
 
         response = template.requestBody("http://localhost:" + port2 + "/hello/world", "hello", String.class);
-        assertEquals("Get a wrong response", "/hello/world", response);
+        assertEquals("/hello/world", response, "Get a wrong response");
 
         try {
             template.requestBody("http://localhost:" + port1 + "/hello/world", "hello", String.class);
             fail("Expect exception here!");
         } catch (Exception ex) {
-            assertTrue("We should get a RuntimeCamelException", ex instanceof RuntimeCamelException);
+            assertTrue(ex instanceof RuntimeCamelException, "We should get a RuntimeCamelException");
         }
     }
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcClientConfigRealmUriTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcClientConfigRealmUriTest.java
index 0f44664..dce95e0 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcClientConfigRealmUriTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcClientConfigRealmUriTest.java
@@ -17,7 +17,9 @@
 package org.apache.camel.component.ahc;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class AhcClientConfigRealmUriTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcClientConfigUriTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcClientConfigUriTest.java
index 835acee..9b29667 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcClientConfigUriTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcClientConfigUriTest.java
@@ -17,7 +17,9 @@
 package org.apache.camel.component.ahc;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class AhcClientConfigUriTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentClientConfigTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentClientConfigTest.java
index 35a3311..6664ada 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentClientConfigTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentClientConfigTest.java
@@ -21,7 +21,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.asynchttpclient.DefaultAsyncHttpClientConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class AhcComponentClientConfigTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentClientConfigWithClientConfigUriParametersTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentClientConfigWithClientConfigUriParametersTest.java
index 2e827b7..50c7b4d 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentClientConfigWithClientConfigUriParametersTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentClientConfigWithClientConfigUriParametersTest.java
@@ -17,7 +17,10 @@
 package org.apache.camel.component.ahc;
 
 import org.apache.camel.Endpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class AhcComponentClientConfigWithClientConfigUriParametersTest extends AhcComponentClientConfigTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentCustomClientConfigTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentCustomClientConfigTest.java
index 7e1d518..3ebba9f 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentCustomClientConfigTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentCustomClientConfigTest.java
@@ -21,7 +21,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.asynchttpclient.DefaultAsyncHttpClientConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class AhcComponentCustomClientConfigTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentNettyClientConfigTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentNettyClientConfigTest.java
index 94c0681..33f370a 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentNettyClientConfigTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcComponentNettyClientConfigTest.java
@@ -21,7 +21,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.asynchttpclient.DefaultAsyncHttpClientConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class AhcComponentNettyClientConfigTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcGoogleTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcGoogleTest.java
index 3c71f5b..f7cb93c 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcGoogleTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcGoogleTest.java
@@ -17,14 +17,14 @@
 package org.apache.camel.component.ahc;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
 /**
  * Requires online internet connection for testing.
  */
-@Ignore("Run this test manual as it requires online internet")
+@Disabled("Run this test manual as it requires online internet")
 public class AhcGoogleTest extends CamelTestSupport {
 
     @Test
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcOperationFailedExceptionTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcOperationFailedExceptionTest.java
index 0ad335d..5a58d41 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcOperationFailedExceptionTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcOperationFailedExceptionTest.java
@@ -16,11 +16,11 @@
  */
 package org.apache.camel.component.ahc;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.IsNot.not;
 import static org.hamcrest.core.StringContains.containsString;
-import static org.junit.Assert.assertThat;
 
 public class AhcOperationFailedExceptionTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduce500Test.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduce500Test.java
index 1843822..42bf0e7 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduce500Test.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduce500Test.java
@@ -20,7 +20,12 @@ import org.apache.camel.CamelExecutionException;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class AhcProduce500Test extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceClientConfigTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceClientConfigTest.java
index 0416a7d..b30a684 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceClientConfigTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceClientConfigTest.java
@@ -21,7 +21,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.asynchttpclient.DefaultAsyncHttpClientConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class AhcProduceClientConfigTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceClientConfigWithClientConfigUriParametersTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceClientConfigWithClientConfigUriParametersTest.java
index 0b023d7..9058c8d 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceClientConfigWithClientConfigUriParametersTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceClientConfigWithClientConfigUriParametersTest.java
@@ -17,7 +17,10 @@
 package org.apache.camel.component.ahc;
 
 import org.apache.camel.Endpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class AhcProduceClientConfigWithClientConfigUriParametersTest extends AhcProduceClientConfigTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceGetHeadersTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceGetHeadersTest.java
index f053f45..72029d3 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceGetHeadersTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceGetHeadersTest.java
@@ -21,7 +21,7 @@ import java.util.Map;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class AhcProduceGetHeadersTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceGetNoSlashInUriTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceGetNoSlashInUriTest.java
index 682b8f6..bcee6b4 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceGetNoSlashInUriTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceGetNoSlashInUriTest.java
@@ -17,7 +17,7 @@
 package org.apache.camel.component.ahc;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class AhcProduceGetNoSlashInUriTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceGetTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceGetTest.java
index 1e53506..0075202 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceGetTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceGetTest.java
@@ -18,7 +18,9 @@ package org.apache.camel.component.ahc;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class AhcProduceGetTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceNoThrowExceptionOnFailureTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceNoThrowExceptionOnFailureTest.java
index 99c1bca..ce6aaa8 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceNoThrowExceptionOnFailureTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceNoThrowExceptionOnFailureTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.ahc;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class AhcProduceNoThrowExceptionOnFailureTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducePostDoWhileTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducePostDoWhileTest.java
index a32275f..87d8307 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducePostDoWhileTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducePostDoWhileTest.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.ahc;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class AhcProducePostDoWhileTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducePostHeadersTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducePostHeadersTest.java
index 40fff12..734fb50 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducePostHeadersTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducePostHeadersTest.java
@@ -21,7 +21,7 @@ import java.util.Map;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class AhcProducePostHeadersTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducePostTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducePostTest.java
index d34f645..d2767e5 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducePostTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducePostTest.java
@@ -18,7 +18,9 @@ package org.apache.camel.component.ahc;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class AhcProducePostTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceTransferExceptionTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceTransferExceptionTest.java
index 4e2076b..c8b3305 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceTransferExceptionTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceTransferExceptionTest.java
@@ -18,7 +18,12 @@ package org.apache.camel.component.ahc;
 
 import org.apache.camel.CamelExecutionException;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class AhcProduceTransferExceptionTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceWithClientConfigUriParametersTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceWithClientConfigUriParametersTest.java
index da1ba0a..fed7ab3 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceWithClientConfigUriParametersTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProduceWithClientConfigUriParametersTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.ahc;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class AhcProduceWithClientConfigUriParametersTest extends BaseAhcTest {
     @Test
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerConnectionCloseHeadersTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerConnectionCloseHeadersTest.java
index 34ade6e..cc37cee 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerConnectionCloseHeadersTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerConnectionCloseHeadersTest.java
@@ -21,7 +21,7 @@ import java.util.Map;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class AhcProducerConnectionCloseHeadersTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java
index 1707957..d39becb 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java
@@ -28,7 +28,7 @@ import org.apache.camel.http.common.cookie.ExchangeCookieHandler;
 import org.apache.camel.http.common.cookie.InstanceCookieHandler;
 import org.asynchttpclient.AsyncHttpClientConfig;
 import org.asynchttpclient.DefaultAsyncHttpClientConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class AhcProducerSessionTest extends BaseAhcTest {
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerTwoParametersWithSameKeyTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerTwoParametersWithSameKeyTest.java
index d3edca1..a4e891b 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerTwoParametersWithSameKeyTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerTwoParametersWithSameKeyTest.java
@@ -22,7 +22,11 @@ import java.util.List;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 /**
  *
@@ -34,7 +38,7 @@ public class AhcProducerTwoParametersWithSameKeyTest extends BaseAhcTest {
         Exchange out = template.request("ahc:http://localhost:{{port}}/myapp?from=me&to=foo&to=bar", null);
 
         assertNotNull(out);
-        assertFalse("Should not fail", out.isFailed());
+        assertFalse(out.isFailed(), "Should not fail");
         assertEquals("OK", out.getOut().getBody(String.class));
         assertEquals("yes", out.getOut().getHeader("bar"));
     }
@@ -53,7 +57,7 @@ public class AhcProducerTwoParametersWithSameKeyTest extends BaseAhcTest {
         });
 
         assertNotNull(out);
-        assertFalse("Should not fail", out.isFailed());
+        assertFalse(out.isFailed(), "Should not fail");
         assertEquals("OK", out.getOut().getBody(String.class));
         assertEquals("yes", out.getOut().getHeader("bar"));
 
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/BaseAhcTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/BaseAhcTest.java
index 791d620..54d7b74 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/BaseAhcTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/BaseAhcTest.java
@@ -27,8 +27,8 @@ import org.apache.camel.support.jsse.SSLContextParameters;
 import org.apache.camel.support.jsse.SSLContextServerParameters;
 import org.apache.camel.support.jsse.TrustManagersParameters;
 import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.BeforeClass;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.BeforeAll;
 
 public abstract class BaseAhcTest extends CamelTestSupport {
 
@@ -36,7 +36,7 @@ public abstract class BaseAhcTest extends CamelTestSupport {
 
     private static volatile int port;
 
-    @BeforeClass
+    @BeforeAll
     public static void initPort() throws Exception {
         port = AvailablePortFinder.getNextAvailable(24000);
     }
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/HttpEndpointURLTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/HttpEndpointURLTest.java
index 108e281..dcea426 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/HttpEndpointURLTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/HttpEndpointURLTest.java
@@ -16,8 +16,10 @@
  */
 package org.apache.camel.component.ahc;
 
-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 HttpEndpointURLTest extends CamelTestSupport {
     
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/HttpHeaderFilterStrategyTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/HttpHeaderFilterStrategyTest.java
index 6b198c3..8447415 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/HttpHeaderFilterStrategyTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/HttpHeaderFilterStrategyTest.java
@@ -19,9 +19,12 @@ package org.apache.camel.component.ahc;
 import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.support.DefaultExchange;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class HttpHeaderFilterStrategyTest extends CamelTestSupport {
 
@@ -29,7 +32,7 @@ public class HttpHeaderFilterStrategyTest extends CamelTestSupport {
     private Exchange exchange;
 
     @Override
-    @Before
+    @BeforeEach
     public void setUp() {
         filter = new HttpHeaderFilterStrategy();
         exchange = new DefaultExchange(new DefaultCamelContext());
diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/javabody/AhcProduceJavaBodyTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/javabody/AhcProduceJavaBodyTest.java
index 4f3804a..77bc296 100644
--- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/javabody/AhcProduceJavaBodyTest.java
+++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/javabody/AhcProduceJavaBodyTest.java
@@ -24,7 +24,13 @@ import org.apache.camel.component.ahc.AhcConstants;
 import org.apache.camel.component.ahc.BaseAhcTest;
 import org.apache.camel.component.jetty.JettyHttpComponent;
 import org.apache.camel.http.common.HttpCommonComponent;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+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;
 
 /**
  *
diff --git a/components/camel-test-junit5/src/main/docs/test-junit5.adoc b/components/camel-test-junit5/src/main/docs/test-junit5.adoc
index 6624d90..ef40e04 100644
--- a/components/camel-test-junit5/src/main/docs/test-junit5.adoc
+++ b/components/camel-test-junit5/src/main/docs/test-junit5.adoc
@@ -44,3 +44,33 @@ public class SimpleMockTest extends CamelTestSupport {
 }
 ----
 
+== Migrating Camel Tests from JUnit 4 to JUnit 5
+Find below some hints to help in migrating camel tests from JUnit 4 to JUnit 5.
+
+=== Referencing the Camel Test JUnit5 library in your project
+Projects using `camel-test` would need to use `camel-test-junit5`. For instance, maven users would update their pom.xml file as below:
+----
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-test-junit5</artifactId>
+  <scope>test</scope>
+</dependency>
+----
+
+=== Typical migration steps linked to JUnit 5 support in Camel Test
+* Imports of `org.apache.camel.test.junit4.*` should be replaced with `org.apache.camel.test.junit5.*`
+* `TestSupport` static methods should be imported where needed, for instance `import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf`
+
+=== Typical migration steps linked to JUnit 5 itself
+Once Camel related steps have been performed, there are still typical JUnit 5 migration steps to remember:
+* New JUnit 5 assertions should be imported where needed, for instance `import static org.junit.jupiter.api.Assertions.assertEquals`
+* Assertion messages should be moved to the last parameter where needed, for instance `assertEquals("message", 2, 1)` becomes `assertEquals(2, 1, "message")`
+* `org.junit.Test` should be changed in favor of `org.junit.jupiter.api.Test`
+* `org.junit.Ignore` should be changed in favor of `org.junit.jupiter.api.Disabled`
+* `org.junit.Before` should be changed in favor of `org.junit.jupiter.api.BeforeEach`
+* `org.junit.After` should be changed in favor of `org.junit.jupiter.api.AfterEach`
+* `org.junit.BeforeClass` should be changed in favor of `import org.junit.jupiter.api.BeforeAll`
+* `org.junit.AfterClass` should be changed in favor of `import org.junit.jupiter.api.AfterAll`
+* Built-in `assertThat` from third-party assertion libraries should be used. For instance, use `org.hamcrest.MatcherAssert.assertThat` from `java-hamcrest`
+
+Depending on the context, more involved tips might be needed, please check the https://junit.org/junit5/docs/current/user-guide/[JUnit 5 User Guide] then.
\ No newline at end of file