You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2019/11/19 08:10:15 UTC

[camel] branch master updated (fa62caf -> edc208d)

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

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


    from fa62caf  Regen
     new e24e9d6  CAMEL-11807: Bumped to maven-surefire-plugin 3.0.0-M4
     new b92e23c  CAMEL-11807: Migrated camel-swagger-java tests to JUnit 5
     new edc208d  CAMEL-11807: Migrated camel-mongodb tests to JUnit 5

The 3 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:
 components/camel-mongodb/pom.xml                   |   7 +-
 .../camel/component/mongodb/MongoDbProducer.java   |  24 ++--
 .../component/mongodb/AbstractMongoDbTest.java     |  21 ++--
 .../mongodb/MongoDbAggregateOperationTest.java     |  43 ++++----
 .../mongodb/MongoDbBigDecimalConverterTest.java    |  10 +-
 .../mongodb/MongoDbBulkWriteOperationTest.java     |  24 ++--
 .../mongodb/MongoDbChangeStreamsConsumerTest.java  |   4 +-
 .../mongodb/MongoDbConnectionBeansTest.java        |  16 ++-
 .../component/mongodb/MongoDbConversionsTest.java  |  28 ++---
 .../component/mongodb/MongoDbDynamicityTest.java   |  47 ++++----
 .../mongodb/MongoDbExceptionHandlingTest.java      |  12 +-
 .../mongodb/MongoDbFindOperationTest.java          | 121 +++++++++++----------
 .../mongodb/MongoDbHeaderHandlingTest.java         |  38 ++++---
 .../camel/component/mongodb/MongoDbIndexTest.java  |  71 ++++++------
 .../component/mongodb/MongoDbOperationsTest.java   | 119 ++++++++++----------
 .../component/mongodb/MongoDbOutputTypeTest.java   |  33 +++---
 .../mongodb/MongoDbReadPreferenceOptionTest.java   |   8 +-
 .../component/mongodb/MongoDbStopEndpointTest.java |   3 +-
 .../mongodb/MongoDbTailableCursorConsumerTest.java |  22 ++--
 .../mongodb/meta/MongoDbMetaExtensionTest.java     |  34 +++---
 .../MongoDbIdempotentRepositoryTest.java           |  43 ++++----
 .../verifier/MongoDbVerifierExtensionTest.java     |  13 +--
 components/camel-swagger-java/pom.xml              |   8 +-
 .../camel/swagger/RestSwaggerArrayEnumTest.java    |   2 +-
 .../RestSwaggerReaderApiDocsOverrideTest.java      |  14 ++-
 .../swagger/RestSwaggerReaderApiDocsTest.java      |  15 ++-
 .../swagger/RestSwaggerReaderDayOfWeekTest.java    |  13 ++-
 ...RestSwaggerReaderEnableVendorExtensionTest.java |  14 ++-
 .../RestSwaggerReaderModelApiSecurityTest.java     |  14 ++-
 .../RestSwaggerReaderModelBookOrderTest.java       |  13 ++-
 .../camel/swagger/RestSwaggerReaderModelTest.java  |  14 ++-
 .../RestSwaggerReaderOverrideHostApiDocsTest.java  |  12 +-
 .../RestSwaggerReaderPropertyPlaceholderTest.java  |  18 ++-
 .../camel/swagger/RestSwaggerReaderTest.java       |  13 ++-
 .../camel/swagger/RestSwaggerSupportTest.java      |   3 +-
 ...pringRestSwaggerReaderModelApiSecurityTest.java |  14 ++-
 .../swagger/SwaggerRestProducerFactoryTest.java    |   2 +-
 .../camel/swagger/producer/RestSwaggerGetTest.java |   4 +-
 .../producer/RestSwaggerGetUriParamTest.java       |   4 +-
 parent/pom.xml                                     |   2 +-
 pom.xml                                            |   2 +-
 41 files changed, 536 insertions(+), 386 deletions(-)


[camel] 01/03: CAMEL-11807: Bumped to maven-surefire-plugin 3.0.0-M4

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e24e9d687b45d7df9dd90bda20674e2aeae339ce
Author: aldettinger <al...@gmail.com>
AuthorDate: Tue Nov 12 15:01:58 2019 +0100

    CAMEL-11807: Bumped to maven-surefire-plugin 3.0.0-M4
---
 parent/pom.xml | 2 +-
 pom.xml        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index 9e157f2..d7a4dd0 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -449,7 +449,7 @@
         <maven-reporting-api-version>2.2.1</maven-reporting-api-version>
         <maven-reporting-impl-version>2.0.5</maven-reporting-impl-version>
         <maven-shade-plugin-version>3.2.1</maven-shade-plugin-version>
-        <maven-surefire-report-plugin-version>3.0.0-M3</maven-surefire-report-plugin-version>
+        <maven-surefire-report-plugin-version>3.0.0-M4</maven-surefire-report-plugin-version>
         <maven-war-plugin-version>3.2.3</maven-war-plugin-version>
         <metrics-version>3.2.6</metrics-version>
         <micrometer-version>1.2.2</micrometer-version>
diff --git a/pom.xml b/pom.xml
index e03a5a5..84ecf58 100644
--- a/pom.xml
+++ b/pom.xml
@@ -117,7 +117,7 @@
 
         <maven-compiler-plugin-version>3.8.1</maven-compiler-plugin-version>
         <maven-javadoc-plugin-version>3.0.1</maven-javadoc-plugin-version>
-        <maven-surefire-plugin-version>3.0.0-M3</maven-surefire-plugin-version>
+        <maven-surefire-plugin-version>3.0.0-M4</maven-surefire-plugin-version>
         <!-- we need to override the version inherited from Apache POM for modules that use this POM as parent -->
         <surefire.version>${maven-surefire-plugin-version}</surefire.version>
 


[camel] 02/03: CAMEL-11807: Migrated camel-swagger-java tests to JUnit 5

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b92e23c95349bbd7aba10727fbbd2b30a0e92823
Author: aldettinger <al...@gmail.com>
AuthorDate: Wed Nov 13 17:03:03 2019 +0100

    CAMEL-11807: Migrated camel-swagger-java tests to JUnit 5
---
 components/camel-swagger-java/pom.xml                  |  8 +-------
 .../apache/camel/swagger/RestSwaggerArrayEnumTest.java |  2 +-
 .../swagger/RestSwaggerReaderApiDocsOverrideTest.java  | 14 +++++++++++---
 .../camel/swagger/RestSwaggerReaderApiDocsTest.java    | 15 ++++++++++++---
 .../camel/swagger/RestSwaggerReaderDayOfWeekTest.java  | 13 ++++++++++---
 .../RestSwaggerReaderEnableVendorExtensionTest.java    | 14 +++++++++++---
 .../swagger/RestSwaggerReaderModelApiSecurityTest.java | 14 +++++++++++---
 .../swagger/RestSwaggerReaderModelBookOrderTest.java   | 13 ++++++++++---
 .../camel/swagger/RestSwaggerReaderModelTest.java      | 14 +++++++++++---
 .../RestSwaggerReaderOverrideHostApiDocsTest.java      | 12 ++++++++++--
 .../RestSwaggerReaderPropertyPlaceholderTest.java      | 18 +++++++++++++-----
 .../apache/camel/swagger/RestSwaggerReaderTest.java    | 13 ++++++++++---
 .../apache/camel/swagger/RestSwaggerSupportTest.java   |  3 +--
 .../SpringRestSwaggerReaderModelApiSecurityTest.java   | 14 +++++++++++---
 .../camel/swagger/SwaggerRestProducerFactoryTest.java  |  2 +-
 .../camel/swagger/producer/RestSwaggerGetTest.java     |  4 ++--
 .../swagger/producer/RestSwaggerGetUriParamTest.java   |  4 ++--
 17 files changed, 128 insertions(+), 49 deletions(-)

diff --git a/components/camel-swagger-java/pom.xml b/components/camel-swagger-java/pom.xml
index 931f556..332be6c 100644
--- a/components/camel-swagger-java/pom.xml
+++ b/components/camel-swagger-java/pom.xml
@@ -131,7 +131,7 @@
         <!-- testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-spring</artifactId>
+            <artifactId>camel-test-spring-junit5</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -153,12 +153,6 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.junit.vintage</groupId>
-            <artifactId>junit-vintage-engine</artifactId>
-            <version>${junit-jupiter-version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.logging.log4j</groupId>
             <artifactId>log4j-api</artifactId>
             <scope>test</scope>
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerArrayEnumTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerArrayEnumTest.java
index bfba159..2cf5da9 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerArrayEnumTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerArrayEnumTest.java
@@ -28,7 +28,7 @@ import io.swagger.models.parameters.Parameter;
 import org.apache.camel.impl.engine.DefaultClassResolver;
 import org.apache.camel.model.rest.RestDefinition;
 import org.apache.camel.model.rest.RestParamType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderApiDocsOverrideTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderApiDocsOverrideTest.java
index aac699f..8e30b5f 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderApiDocsOverrideTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderApiDocsOverrideTest.java
@@ -25,11 +25,19 @@ import org.apache.camel.BindToRegistry;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.engine.DefaultClassResolver;
 import org.apache.camel.model.rest.RestParamType;
-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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class RestSwaggerReaderApiDocsOverrideTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(RestSwaggerReaderApiDocsOverrideTest.class);
+
     @BindToRegistry("dummy-rest")
     private DummyRestConsumerFactory factory = new DummyRestConsumerFactory();
 
@@ -63,7 +71,7 @@ public class RestSwaggerReaderApiDocsOverrideTest extends CamelTestSupport {
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         String json = mapper.writeValueAsString(swagger);
 
-        log.info(json);
+        LOG.info(json);
 
         assertFalse(json.contains("\"/hello/bye\""));
         assertFalse(json.contains("\"summary\" : \"To update the greeting message\""));
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderApiDocsTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderApiDocsTest.java
index 322d00c..b037dd6 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderApiDocsTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderApiDocsTest.java
@@ -25,11 +25,19 @@ import org.apache.camel.BindToRegistry;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.engine.DefaultClassResolver;
 import org.apache.camel.model.rest.RestParamType;
-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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class RestSwaggerReaderApiDocsTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(RestSwaggerReaderApiDocsTest.class);
+
     @BindToRegistry("dummy-rest")
     private DummyRestConsumerFactory factory = new DummyRestConsumerFactory();
 
@@ -49,6 +57,7 @@ public class RestSwaggerReaderApiDocsTest extends CamelTestSupport {
 
     @Test
     public void testReaderRead() throws Exception {
+
         BeanConfig config = new BeanConfig();
         config.setHost("localhost:8080");
         config.setSchemes(new String[] {"http"});
@@ -63,7 +72,7 @@ public class RestSwaggerReaderApiDocsTest extends CamelTestSupport {
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         String json = mapper.writeValueAsString(swagger);
 
-        log.info(json);
+        LOG.info(json);
 
         assertTrue(json.contains("\"host\" : \"localhost:8080\""));
         assertTrue(json.contains("\"basePath\" : \"/api\""));
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderDayOfWeekTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderDayOfWeekTest.java
index 6f013a6..fffc3b3 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderDayOfWeekTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderDayOfWeekTest.java
@@ -25,11 +25,18 @@ import org.apache.camel.BindToRegistry;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.engine.DefaultClassResolver;
 import org.apache.camel.model.rest.RestParamType;
-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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class RestSwaggerReaderDayOfWeekTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(RestSwaggerReaderDayOfWeekTest.class);
+
     @BindToRegistry("dummy-rest")
     private DummyRestConsumerFactory factory = new DummyRestConsumerFactory();
 
@@ -68,7 +75,7 @@ public class RestSwaggerReaderDayOfWeekTest extends CamelTestSupport {
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         String json = mapper.writeValueAsString(swagger);
 
-        log.info(json);
+        LOG.info(json);
 
         assertTrue(json.contains("\"host\" : \"localhost:8080\""));
         assertTrue(json.contains("\"default\" : \"friday\""));
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderEnableVendorExtensionTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderEnableVendorExtensionTest.java
index d4fc26c..da42e83 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderEnableVendorExtensionTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderEnableVendorExtensionTest.java
@@ -25,11 +25,19 @@ import org.apache.camel.BindToRegistry;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.engine.DefaultClassResolver;
 import org.apache.camel.model.rest.RestParamType;
-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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class RestSwaggerReaderEnableVendorExtensionTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(RestSwaggerReaderEnableVendorExtensionTest.class);
+
     @BindToRegistry("dummy-rest")
     private DummyRestConsumerFactory factory = new DummyRestConsumerFactory();
 
@@ -75,7 +83,7 @@ public class RestSwaggerReaderEnableVendorExtensionTest extends CamelTestSupport
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         String json = mapper.writeValueAsString(swagger);
 
-        log.info(json);
+        LOG.info(json);
 
         String camelId = context.getName();
         String routeId = context.getRouteDefinitions().get(0).getId();
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderModelApiSecurityTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderModelApiSecurityTest.java
index 2dab809..61a3237 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderModelApiSecurityTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderModelApiSecurityTest.java
@@ -25,11 +25,19 @@ import org.apache.camel.BindToRegistry;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.engine.DefaultClassResolver;
 import org.apache.camel.model.rest.RestParamType;
-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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class RestSwaggerReaderModelApiSecurityTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(RestSwaggerReaderModelApiSecurityTest.class);
+
     @BindToRegistry("dummy-rest")
     private DummyRestConsumerFactory factory = new DummyRestConsumerFactory();
 
@@ -78,7 +86,7 @@ public class RestSwaggerReaderModelApiSecurityTest extends CamelTestSupport {
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         String json = mapper.writeValueAsString(swagger);
 
-        log.info(json);
+        LOG.info(json);
 
         assertTrue(json.contains("\"securityDefinitions\" : {"));
         assertTrue(json.contains("\"type\" : \"oauth2\","));
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderModelBookOrderTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderModelBookOrderTest.java
index 7efc197..efe4467 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderModelBookOrderTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderModelBookOrderTest.java
@@ -25,11 +25,18 @@ import org.apache.camel.BindToRegistry;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.engine.DefaultClassResolver;
 import org.apache.camel.model.rest.RestParamType;
-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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class RestSwaggerReaderModelBookOrderTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(RestSwaggerReaderModelBookOrderTest.class);
+
     @BindToRegistry("dummy-rest")
     private DummyRestConsumerFactory factory = new DummyRestConsumerFactory();
 
@@ -67,7 +74,7 @@ public class RestSwaggerReaderModelBookOrderTest extends CamelTestSupport {
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         String json = mapper.writeValueAsString(swagger);
 
-        log.info(json);
+        LOG.info(json);
 
         assertTrue(json.contains("\"host\" : \"localhost:8080\""));
         assertTrue(json.contains("\"description\" : \"The order returned\""));
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderModelTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderModelTest.java
index 33b1a92..32e52e6 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderModelTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderModelTest.java
@@ -25,11 +25,19 @@ import org.apache.camel.BindToRegistry;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.engine.DefaultClassResolver;
 import org.apache.camel.model.rest.RestParamType;
-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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class RestSwaggerReaderModelTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(RestSwaggerReaderModelTest.class);
+
     @BindToRegistry("dummy-rest")
     private DummyRestConsumerFactory factory = new DummyRestConsumerFactory();
 
@@ -73,7 +81,7 @@ public class RestSwaggerReaderModelTest extends CamelTestSupport {
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         String json = mapper.writeValueAsString(swagger);
 
-        log.info(json);
+        LOG.info(json);
 
         assertTrue(json.contains("\"host\" : \"localhost:8080\""));
         assertTrue(json.contains("\"description\" : \"The user returned\""));
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderOverrideHostApiDocsTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderOverrideHostApiDocsTest.java
index 9475517..bc885d7 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderOverrideHostApiDocsTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderOverrideHostApiDocsTest.java
@@ -22,10 +22,18 @@ import com.fasterxml.jackson.databind.SerializationFeature;
 import io.swagger.jaxrs.config.BeanConfig;
 import io.swagger.models.Swagger;
 import org.apache.camel.impl.engine.DefaultClassResolver;
-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.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class RestSwaggerReaderOverrideHostApiDocsTest extends RestSwaggerReaderApiDocsTest {
 
+    private static final Logger LOG = LoggerFactory.getLogger(RestSwaggerReaderOverrideHostApiDocsTest.class);
+
     @Override
     @Test
     public void testReaderRead() throws Exception {
@@ -44,7 +52,7 @@ public class RestSwaggerReaderOverrideHostApiDocsTest extends RestSwaggerReaderA
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         String json = mapper.writeValueAsString(swagger);
 
-        log.info(json);
+        LOG.info(json);
 
         assertTrue(json.contains("\"host\" : \"http:mycoolserver:8888/myapi\""));
         assertTrue(json.contains("\"basePath\" : \"/api\""));
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderPropertyPlaceholderTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderPropertyPlaceholderTest.java
index 8c6d218..387a155 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderPropertyPlaceholderTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderPropertyPlaceholderTest.java
@@ -30,13 +30,21 @@ import org.apache.camel.impl.engine.DefaultClassResolver;
 import org.apache.camel.model.rest.RestDefinition;
 import org.apache.camel.model.rest.RestParamType;
 import org.apache.camel.swagger.producer.DummyRestProducerFactory;
-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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-@Ignore("Does not run well on CI due test uses JMX mbeans")
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@Disabled("Does not run well on CI due test uses JMX mbeans")
 public class RestSwaggerReaderPropertyPlaceholderTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(RestSwaggerReaderPropertyPlaceholderTest.class);
+
     @BindToRegistry("dummy-rest")
     private DummyRestProducerFactory factory = new DummyRestProducerFactory();
 
@@ -86,7 +94,7 @@ public class RestSwaggerReaderPropertyPlaceholderTest extends CamelTestSupport {
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         String json = mapper.writeValueAsString(swagger);
 
-        log.info(json);
+        LOG.info(json);
 
         assertTrue(json.contains("\"host\" : \"localhost:8080\""));
         assertTrue(json.contains("\"basePath\" : \"/api\""));
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderTest.java
index 0071d7d..363fd10 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerReaderTest.java
@@ -25,11 +25,18 @@ import org.apache.camel.BindToRegistry;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.engine.DefaultClassResolver;
 import org.apache.camel.model.rest.RestParamType;
-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 org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class RestSwaggerReaderTest extends CamelTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(RestSwaggerReaderTest.class);
+
     @BindToRegistry("dummy-rest")
     private DummyRestConsumerFactory factory = new DummyRestConsumerFactory();
 
@@ -64,7 +71,7 @@ public class RestSwaggerReaderTest extends CamelTestSupport {
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         String json = mapper.writeValueAsString(swagger);
 
-        log.info(json);
+        LOG.info(json);
 
         assertTrue(json.contains("\"host\" : \"localhost:8080\""));
         assertTrue(json.contains("\"basePath\" : \"/api\""));
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerSupportTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerSupportTest.java
index d9042e5..59dbc13 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerSupportTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/RestSwaggerSupportTest.java
@@ -32,7 +32,6 @@ import static org.junit.jupiter.params.provider.Arguments.arguments;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
-import static org.mockito.Mockito.verifyZeroInteractions;
 
 public class RestSwaggerSupportTest {
 
@@ -90,7 +89,7 @@ public class RestSwaggerSupportTest {
 
         RestSwaggerSupport.setupXForwardedHeaders(swagger, Collections.emptyMap());
 
-        verifyZeroInteractions(swagger);
+        verifyNoMoreInteractions(swagger);
     }
 
     static Stream<Arguments> basePathAndPrefixVariations() {
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/SpringRestSwaggerReaderModelApiSecurityTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/SpringRestSwaggerReaderModelApiSecurityTest.java
index 27f9841..7134593 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/SpringRestSwaggerReaderModelApiSecurityTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/SpringRestSwaggerReaderModelApiSecurityTest.java
@@ -22,13 +22,21 @@ import com.fasterxml.jackson.databind.SerializationFeature;
 import io.swagger.jaxrs.config.BeanConfig;
 import io.swagger.models.Swagger;
 import org.apache.camel.impl.engine.DefaultClassResolver;
-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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 public class SpringRestSwaggerReaderModelApiSecurityTest extends CamelSpringTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(SpringRestSwaggerReaderModelApiSecurityTest.class);
+
     @Override
     protected AbstractApplicationContext createApplicationContext() {
         return new ClassPathXmlApplicationContext("org/apache/camel/swagger/SpringRestSwaggerReaderModelApiSecurityTest.xml");
@@ -53,7 +61,7 @@ public class SpringRestSwaggerReaderModelApiSecurityTest extends CamelSpringTest
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         String json = mapper.writeValueAsString(swagger);
 
-        log.info(json);
+        LOG.info(json);
 
         assertTrue(json.contains("\"securityDefinitions\" : {"));
         assertTrue(json.contains("\"type\" : \"oauth2\","));
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/SwaggerRestProducerFactoryTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/SwaggerRestProducerFactoryTest.java
index a84889b..1d76488 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/SwaggerRestProducerFactoryTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/SwaggerRestProducerFactoryTest.java
@@ -17,7 +17,7 @@
 package org.apache.camel.swagger;
 
 import org.apache.camel.impl.DefaultCamelContext;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class SwaggerRestProducerFactoryTest {
 
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/producer/RestSwaggerGetTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/producer/RestSwaggerGetTest.java
index f28f260..b0ab3bb 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/producer/RestSwaggerGetTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/producer/RestSwaggerGetTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.swagger.producer;
 import org.apache.camel.BindToRegistry;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
 
 public class RestSwaggerGetTest extends CamelTestSupport {
 
diff --git a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/producer/RestSwaggerGetUriParamTest.java b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/producer/RestSwaggerGetUriParamTest.java
index 2f625ee..beed34c 100644
--- a/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/producer/RestSwaggerGetUriParamTest.java
+++ b/components/camel-swagger-java/src/test/java/org/apache/camel/swagger/producer/RestSwaggerGetUriParamTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.swagger.producer;
 import org.apache.camel.BindToRegistry;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
 
 public class RestSwaggerGetUriParamTest extends CamelTestSupport {
 


[camel] 03/03: CAMEL-11807: Migrated camel-mongodb tests to JUnit 5

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit edc208d0ae3aad80b3e97bf5b13d11a62be770fe
Author: aldettinger <al...@gmail.com>
AuthorDate: Sat Nov 16 09:50:37 2019 +0100

    CAMEL-11807: Migrated camel-mongodb tests to JUnit 5
---
 components/camel-mongodb/pom.xml                   |   7 +-
 .../camel/component/mongodb/MongoDbProducer.java   |  24 ++--
 .../component/mongodb/AbstractMongoDbTest.java     |  21 ++--
 .../mongodb/MongoDbAggregateOperationTest.java     |  43 ++++----
 .../mongodb/MongoDbBigDecimalConverterTest.java    |  10 +-
 .../mongodb/MongoDbBulkWriteOperationTest.java     |  24 ++--
 .../mongodb/MongoDbChangeStreamsConsumerTest.java  |   4 +-
 .../mongodb/MongoDbConnectionBeansTest.java        |  16 ++-
 .../component/mongodb/MongoDbConversionsTest.java  |  28 ++---
 .../component/mongodb/MongoDbDynamicityTest.java   |  47 ++++----
 .../mongodb/MongoDbExceptionHandlingTest.java      |  12 +-
 .../mongodb/MongoDbFindOperationTest.java          | 121 +++++++++++----------
 .../mongodb/MongoDbHeaderHandlingTest.java         |  38 ++++---
 .../camel/component/mongodb/MongoDbIndexTest.java  |  71 ++++++------
 .../component/mongodb/MongoDbOperationsTest.java   | 119 ++++++++++----------
 .../component/mongodb/MongoDbOutputTypeTest.java   |  33 +++---
 .../mongodb/MongoDbReadPreferenceOptionTest.java   |   8 +-
 .../component/mongodb/MongoDbStopEndpointTest.java |   3 +-
 .../mongodb/MongoDbTailableCursorConsumerTest.java |  22 ++--
 .../mongodb/meta/MongoDbMetaExtensionTest.java     |  34 +++---
 .../MongoDbIdempotentRepositoryTest.java           |  43 ++++----
 .../verifier/MongoDbVerifierExtensionTest.java     |  13 +--
 22 files changed, 406 insertions(+), 335 deletions(-)

diff --git a/components/camel-mongodb/pom.xml b/components/camel-mongodb/pom.xml
index 7bcccc4..b2e32fe 100644
--- a/components/camel-mongodb/pom.xml
+++ b/components/camel-mongodb/pom.xml
@@ -58,7 +58,7 @@
         <!-- test dependencies -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-spring</artifactId>
+            <artifactId>camel-test-spring-junit5</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -77,11 +77,6 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>de.flapdoodle.embed</groupId>
             <artifactId>de.flapdoodle.embed.mongo</artifactId>
             <scope>test</scope>
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java
index 3e1f069..71a771f 100644
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java
+++ b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java
@@ -256,12 +256,12 @@ public class MongoDbProducer extends DefaultProducer {
     }
 
     private void copyHeaders(Exchange exchange) {
-        MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), false);
+        MessageHelper.copyHeaders(exchange.getIn(), exchange.getMessage(), false);
     }
 
     private void moveBodyToOutIfResultIsReturnedAsHeader(Exchange exchange, MongoDbOperation operation) {
         if (isWriteOperation(operation) && endpoint.isWriteResultAsHeader()) {
-            exchange.getOut().setBody(exchange.getIn().getBody());
+            exchange.getMessage().setBody(exchange.getIn().getBody());
         }
     }
 
@@ -269,9 +269,9 @@ public class MongoDbProducer extends DefaultProducer {
         // determine where to set the WriteResult: as the OUT body or as an IN
         // message header
         if (isWriteOperation(operation) && endpoint.isWriteResultAsHeader()) {
-            exchange.getOut().setHeader(WRITERESULT, result);
+            exchange.getMessage().setHeader(WRITERESULT, result);
         } else {
-            exchange.getOut().setBody(result);
+            exchange.getMessage().setBody(result);
         }
     }
 
@@ -301,7 +301,7 @@ public class MongoDbProducer extends DefaultProducer {
                 }
 
                 Document ret = dbCol.find(query).projection(fieldFilter).sort(sortBy).first();
-                exchange.getOut().setHeader(RESULT_TOTAL_SIZE, ret == null ? 0 : 1);
+                exchange.getMessage().setHeader(RESULT_TOTAL_SIZE, ret == null ? 0 : 1);
                 return ret;
             } catch (InvalidPayloadException e) {
                 throw new CamelMongoDbException("Payload is no Document", e);
@@ -339,7 +339,7 @@ public class MongoDbProducer extends DefaultProducer {
 
             try {
                 ret.iterator().forEachRemaining(((List<String>) result)::add);
-                exchange.getOut().setHeader(MongoDbConstants.RESULT_PAGE_SIZE, ((List<String>) result).size());
+                exchange.getMessage().setHeader(MongoDbConstants.RESULT_PAGE_SIZE, ((List<String>) result).size());
             } finally {
                 ret.iterator().close();
             }
@@ -397,7 +397,7 @@ public class MongoDbProducer extends DefaultProducer {
                 try {
                     result = new ArrayList<>();
                     ret.iterator().forEachRemaining(((List<Document>)result)::add);
-                    exchange.getOut().setHeader(RESULT_PAGE_SIZE, ((List<Document>)result).size());
+                    exchange.getMessage().setHeader(RESULT_PAGE_SIZE, ((List<Document>)result).size());
                 } finally {
                     ret.iterator().close();
                 }
@@ -479,9 +479,9 @@ public class MongoDbProducer extends DefaultProducer {
                     result = dbCol.updateMany(updateCriteria, objNew, options);
                 }
                 if (result.isModifiedCountAvailable()) {
-                    exchange.getOut().setHeader(RECORDS_AFFECTED, result.getModifiedCount());
+                    exchange.getMessage().setHeader(RECORDS_AFFECTED, result.getModifiedCount());
                 }
-                exchange.getOut().setHeader(RECORDS_MATCHED, result.getMatchedCount());
+                exchange.getMessage().setHeader(RECORDS_MATCHED, result.getMatchedCount());
                 return result;
             } catch (InvalidPayloadException e) {
                 throw new CamelMongoDbException("Invalid payload for update", e);
@@ -497,7 +497,7 @@ public class MongoDbProducer extends DefaultProducer {
 
                 DeleteResult result = dbCol.deleteMany(removeObj);
                 if (result.wasAcknowledged()) {
-                    exchange.getOut().setHeader(RECORDS_AFFECTED, result.getDeletedCount());
+                    exchange.getMessage().setHeader(RECORDS_AFFECTED, result.getDeletedCount());
                 }
                 return result;
             } catch (InvalidPayloadException e) {
@@ -540,7 +540,7 @@ public class MongoDbProducer extends DefaultProducer {
                     try {
                         result = new ArrayList<>();
                         aggregationResult.iterator().forEachRemaining(((List<Document>) result)::add);
-                        exchange.getOut().setHeader(MongoDbConstants.RESULT_PAGE_SIZE, ((List<Document>) result).size());
+                        exchange.getMessage().setHeader(MongoDbConstants.RESULT_PAGE_SIZE, ((List<Document>) result).size());
                     } finally {
                         aggregationResult.iterator().close();
                     }
@@ -584,7 +584,7 @@ public class MongoDbProducer extends DefaultProducer {
                     fieldFilter = new Document();
                 }
                 ret = dbCol.find(o).projection(fieldFilter).first();
-                exchange.getOut().setHeader(RESULT_TOTAL_SIZE, ret == null ? 0 : 1);
+                exchange.getMessage().setHeader(RESULT_TOTAL_SIZE, ret == null ? 0 : 1);
                 return ret;
             } catch (InvalidPayloadException e) {
                 throw new CamelMongoDbException("Invalid payload for findById", e);
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/AbstractMongoDbTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/AbstractMongoDbTest.java
index 53d2210..b9ca2df 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/AbstractMongoDbTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/AbstractMongoDbTest.java
@@ -24,14 +24,17 @@ import com.mongodb.client.MongoDatabase;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelExecutionException;
 import org.apache.camel.spring.SpringCamelContext;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.bson.Document;
-import org.junit.After;
+import org.junit.jupiter.api.AfterEach;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 public abstract class AbstractMongoDbTest extends CamelTestSupport {
 
     protected static final String SCHEME = "mongodb";
@@ -71,7 +74,7 @@ public abstract class AbstractMongoDbTest extends CamelTestSupport {
     }
 
     @Override
-    @After
+    @AfterEach
     public void tearDown() throws Exception {
         testCollection.drop();
         dynamicCollection.drop();
@@ -95,7 +98,7 @@ public abstract class AbstractMongoDbTest extends CamelTestSupport {
     protected void createAuthorizationUser() {
         MongoDatabase admin = mongo.getDatabase("admin");
         MongoCollection<Document> usersCollection = admin.getCollection("system.users");
-        if (usersCollection.count() == 0) {
+        if (usersCollection.countDocuments() == 0) {
             usersCollection.insertOne(Document.parse("{\n"
                     + "    \"_id\": \"admin.test-user\",\n"
                     + "    \"user\": \"test-user\",\n"
@@ -126,17 +129,17 @@ public abstract class AbstractMongoDbTest extends CamelTestSupport {
             IOHelper.close(f);
             testCollection.insertOne(Document.parse(doc));
         }
-        assertEquals("Data pumping of 1000 entries did not complete entirely", 1000L, testCollection.count());
+        assertEquals(1000L, testCollection.countDocuments(), "Data pumping of 1000 entries did not complete entirely");
     }
 
     protected CamelMongoDbException extractAndAssertCamelMongoDbException(Object result, String message) {
-        assertTrue("Result is not an Exception", result instanceof Throwable);
-        assertTrue("Result is not an CamelExecutionException", result instanceof CamelExecutionException);
+        assertTrue(result instanceof Throwable, "Result is not an Exception");
+        assertTrue(result instanceof CamelExecutionException, "Result is not an CamelExecutionException");
         Throwable exc = ((CamelExecutionException)result).getCause();
-        assertTrue("Result is not an CamelMongoDbException", exc instanceof CamelMongoDbException);
+        assertTrue(exc instanceof CamelMongoDbException, "Result is not an CamelMongoDbException");
         CamelMongoDbException camelExc = ObjectHelper.cast(CamelMongoDbException.class, exc);
         if (message != null) {
-            assertTrue("CamelMongoDbException doesn't contain desired message string", camelExc.getMessage().contains(message));
+            assertTrue(camelExc.getMessage().contains(message), "CamelMongoDbException doesn't contain desired message string");
         }
         return camelExc;
     }
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbAggregateOperationTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbAggregateOperationTest.java
index 9473b5a..6d1fcc3 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbAggregateOperationTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbAggregateOperationTest.java
@@ -23,7 +23,12 @@ import java.util.Map;
 import com.mongodb.client.MongoIterable;
 import org.apache.camel.builder.RouteBuilder;
 import org.bson.Document;
-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.assertTrue;
+import static org.apache.camel.test.junit5.TestSupport.assertListSize;
 
 public class MongoDbAggregateOperationTest extends AbstractMongoDbTest {
 
@@ -31,7 +36,7 @@ public class MongoDbAggregateOperationTest extends AbstractMongoDbTest {
     @Test
     public void testAggregate() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         // result sorted by _id
@@ -40,46 +45,46 @@ public class MongoDbAggregateOperationTest extends AbstractMongoDbTest {
                          "[{ $match : {$or : [{\"scientist\" : \"Darwin\"},{\"scientist\" : \"Einstein\"}]}},"
                          + "{ $group: { _id: \"$scientist\", count: { $sum: 1 }} },{ $sort : { _id : 1}} ]");
         
-        assertTrue("Result is not of type List", result instanceof List);
+        assertTrue(result instanceof List, "Result is not of type List");
 
         @SuppressWarnings("unchecked")
         List<Document> resultList = (List<Document>) result;
         assertListSize("Result does not contain 2 elements", resultList, 2);
 
-        assertEquals("First result Document._id should be Darwin", "Darwin", resultList.get(0).get("_id"));
-        assertEquals("First result Document.count should be 100", 100, resultList.get(0).get("count"));
-        assertEquals("Second result Document._id should be Einstein", "Einstein", resultList.get(1).get("_id"));
-        assertEquals("Second result Document.count should be 100", 100, resultList.get(1).get("count"));
+        assertEquals("Darwin", resultList.get(0).get("_id"), "First result Document._id should be Darwin");
+        assertEquals(100, resultList.get(0).get("count"), "First result Document.count should be 100");
+        assertEquals("Einstein", resultList.get(1).get("_id"), "Second result Document._id should be Einstein");
+        assertEquals(100, resultList.get(1).get("count"), "Second result Document.count should be 100");
     }
     
     @Test
     public void testAggregateDBCursor() {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         Object result = template
                 .requestBody("direct:aggregateDBCursor",
                         "[{ $match : {$or : [{\"scientist\" : \"Darwin\"},{\"scientist\" : \"Einstein\"}]}}]");
         
-        assertTrue("Result is not of type DBCursor", result instanceof MongoIterable);
+        assertTrue(result instanceof MongoIterable, "Result is not of type DBCursor");
 
         MongoIterable<Document> resultCursor = (MongoIterable<Document>) result;
         // Ensure that all returned documents contain all fields
         int count = 0;
         for (Document document : resultCursor) {
-            assertNotNull("Document in returned list should contain all fields", document.get("_id"));
-            assertNotNull("Document in returned list should contain all fields", document.get("scientist"));
-            assertNotNull("Document in returned list should contain all fields", document.get("fixedField"));
+            assertNotNull(document.get("_id"), "Document in returned list should contain all fields");
+            assertNotNull(document.get("scientist"), "Document in returned list should contain all fields");
+            assertNotNull(document.get("fixedField"), "Document in returned list should contain all fields");
             count++;
         }
-        assertEquals("Result does not contain 200 elements", 200, count);
+        assertEquals(200, count, "Result does not contain 200 elements");
     }
 
     @Test
     public void testAggregateWithOptions() {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         Map<String, Object> options = new HashMap<>();
@@ -90,19 +95,19 @@ public class MongoDbAggregateOperationTest extends AbstractMongoDbTest {
                 .requestBodyAndHeaders("direct:aggregateDBCursor",
                         "[{ $match : {$or : [{\"scientist\" : \"Darwin\"},{\"scientist\" : \"Einstein\"}]}}]", options);
 
-        assertTrue("Result is not of type DBCursor", result instanceof MongoIterable);
+        assertTrue(result instanceof MongoIterable, "Result is not of type DBCursor");
 
         MongoIterable<Document> resultCursor = (MongoIterable<Document>) result;
 
         // Ensure that all returned documents contain all fields
         int count = 0;
         for (Document document : resultCursor) {
-            assertNotNull("Document in returned list should contain all fields", document.get("_id"));
-            assertNotNull("Document in returned list should contain all fields", document.get("scientist"));
-            assertNotNull("Document in returned list should contain all fields", document.get("fixedField"));
+            assertNotNull(document.get("_id"), "Document in returned list should contain all fields");
+            assertNotNull(document.get("scientist"), "Document in returned list should contain all fields");
+            assertNotNull(document.get("fixedField"), "Document in returned list should contain all fields");
             count++;
         }
-        assertEquals("Result does not contain 200 elements", 200, count);
+        assertEquals(200, count, "Result does not contain 200 elements");
     }
 
 
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbBigDecimalConverterTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbBigDecimalConverterTest.java
index 199bf8a..2a58eca 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbBigDecimalConverterTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbBigDecimalConverterTest.java
@@ -21,7 +21,11 @@ import java.math.BigDecimal;
 import com.mongodb.BasicDBObject;
 import org.apache.camel.builder.RouteBuilder;
 import org.bson.Document;
-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.assertTrue;
 
 public class MongoDbBigDecimalConverterTest extends AbstractMongoDbTest {
 
@@ -37,12 +41,12 @@ public class MongoDbBigDecimalConverterTest extends AbstractMongoDbTest {
 
     @Test
     public void testBigDecimalAutoConversion() {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         NumberClass testClass = new NumberClass();
         Object result = template.requestBody("direct:insert", testClass);
         assertTrue(result instanceof Document);
         Document b = testCollection.find(new BasicDBObject("_id", testClass._id)).first();
-        assertNotNull("No record with 'testInsertString' _id", b);
+        assertNotNull(b, "No record with 'testInsertString' _id");
 
         assertTrue(testClass.aNumber.equals(new BigDecimal((double) b.get("aNumber"))));
         assertEquals(testClass.bNumber, new BigDecimal((double) b.get("bNumber")));
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbBulkWriteOperationTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbBulkWriteOperationTest.java
index 6e2bec9..bf6b7f1 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbBulkWriteOperationTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbBulkWriteOperationTest.java
@@ -30,14 +30,18 @@ import com.mongodb.client.model.WriteModel;
 import org.apache.camel.CamelExecutionException;
 import org.apache.camel.builder.RouteBuilder;
 import org.bson.Document;
-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.fail;
 
 public class MongoDbBulkWriteOperationTest extends AbstractMongoDbTest {
 
     @Test
     public void testBulkWrite() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
         List<WriteModel<Document>> bulkOperations = Arrays
             .asList(new InsertOneModel<>(new Document("scientist", "Pierre Curie")),
@@ -53,18 +57,18 @@ public class MongoDbBulkWriteOperationTest extends AbstractMongoDbTest {
 
         assertNotNull(result);
         // 1 insert
-        assertEquals("Records inserted should be 2 : ", 1, result.getInsertedCount());
+        assertEquals(1, result.getInsertedCount(), "Records inserted should be 2 : ");
         // 1 updateOne + 100 updateMany + 1 replaceOne
-        assertEquals("Records matched should be 102 : ", 102, result.getMatchedCount());
-        assertEquals("Records modified should be 102 : ", 102, result.getModifiedCount());
+        assertEquals(102, result.getMatchedCount(), "Records matched should be 102 : ");
+        assertEquals(102, result.getModifiedCount(), "Records modified should be 102 : ");
         // 1 deleteOne + 100 deleteMany
-        assertEquals("Records deleted should be 101 : ", 101, result.getDeletedCount());
+        assertEquals(101, result.getDeletedCount(), "Records deleted should be 101 : ");
     }
 
     @Test
     public void testOrderedBulkWriteWithError() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         List<WriteModel<Document>> bulkOperations = Arrays
@@ -81,14 +85,14 @@ public class MongoDbBulkWriteOperationTest extends AbstractMongoDbTest {
         } catch (CamelExecutionException e) {
             extractAndAssertCamelMongoDbException(e, "duplicate key error");
             // count = 1000 records + 1 inserted
-            assertEquals(1001, testCollection.count());
+            assertEquals(1001, testCollection.countDocuments());
         }
     }
 
     @Test
     public void testUnorderedBulkWriteWithError() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         List<WriteModel<Document>> bulkOperations = Arrays
@@ -104,7 +108,7 @@ public class MongoDbBulkWriteOperationTest extends AbstractMongoDbTest {
         } catch (CamelExecutionException e) {
             extractAndAssertCamelMongoDbException(e, "duplicate key error");
             // count = 1000 + 2 inserted + 1 deleted
-            assertEquals(1001, testCollection.count());
+            assertEquals(1001, testCollection.countDocuments());
         }
     }
 
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbChangeStreamsConsumerTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbChangeStreamsConsumerTest.java
index dc1bfe0..c596be8 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbChangeStreamsConsumerTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbChangeStreamsConsumerTest.java
@@ -21,7 +21,9 @@ import com.mongodb.client.model.CreateCollectionOptions;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.bson.Document;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class MongoDbChangeStreamsConsumerTest extends AbstractMongoDbTest {
 
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbConnectionBeansTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbConnectionBeansTest.java
index 8d8e246..cc12f1a 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbConnectionBeansTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbConnectionBeansTest.java
@@ -18,7 +18,12 @@ package org.apache.camel.component.mongodb;
 
 import com.mongodb.MongoClient;
 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.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;
 
 public class MongoDbConnectionBeansTest extends AbstractMongoDbTest {
 
@@ -50,11 +55,12 @@ public class MongoDbConnectionBeansTest extends AbstractMongoDbTest {
         assertEquals(myDbS, testEndpoint.getMongoConnection());
     }
 
-    @Test(expected = Exception.class)
+    @Test
     public void checkMissingConnection() {
-        MongoDbEndpoint testEndpoint = context.getEndpoint(
-                "mongodb:anythingNotRelated?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=count&dynamicity=true",
-                MongoDbEndpoint.class);
+        assertThrows(Exception.class, () -> {
+            MongoDbEndpoint testEndpoint = context
+                .getEndpoint("mongodb:anythingNotRelated?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=count&dynamicity=true", MongoDbEndpoint.class);
+        });
     }
 
     @Test
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbConversionsTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbConversionsTest.java
index a5b2ec1..3e80f42 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbConversionsTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbConversionsTest.java
@@ -23,16 +23,18 @@ import java.util.Map;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.converter.IOConverter;
 import org.bson.Document;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static com.mongodb.client.model.Filters.eq;
 import static org.apache.camel.component.mongodb.MongoDbConstants.MONGO_ID;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 public class MongoDbConversionsTest extends AbstractMongoDbTest {
 
     @Test
     public void testInsertMap() throws InterruptedException {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
 
         Map<String, Object> m1 = new HashMap<>();
         Map<String, String> m1Nested = new HashMap<>();
@@ -48,56 +50,56 @@ public class MongoDbConversionsTest extends AbstractMongoDbTest {
         // Object result =
         template.requestBody("direct:insertMap", m1);
         Document b = testCollection.find(eq(MONGO_ID, "testInsertMap")).first();
-        assertNotNull("No record with 'testInsertMap' _id", b);
+        assertNotNull(b, "No record with 'testInsertMap' _id");
     }
 
     @Test
     public void testInsertPojo() {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         // Object result =
         template.requestBody("direct:insertPojo", new MyPojoTest());
         Document b = testCollection.find(eq(MONGO_ID, "testInsertPojo")).first();
-        assertNotNull("No record with 'testInsertPojo' _id", b);
+        assertNotNull(b, "No record with 'testInsertPojo' _id");
     }
 
     @Test
     public void testInsertJsonString() {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         // Object result =
         template.requestBody("direct:insertJsonString", "{\"fruits\": [\"apple\", \"banana\", \"papaya\"], \"veggie\": \"broccoli\", \"_id\": \"testInsertJsonString\"}");
         // assertTrue(result instanceof WriteResult);
         Document b = testCollection.find(eq(MONGO_ID, "testInsertJsonString")).first();
-        assertNotNull("No record with 'testInsertJsonString' _id", b);
+        assertNotNull(b, "No record with 'testInsertJsonString' _id");
     }
 
     @Test
     public void testInsertJsonInputStream() throws Exception {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         // Object result =
         template.requestBody("direct:insertJsonString",
                              IOConverter.toInputStream("{\"fruits\": [\"apple\", \"banana\"], \"veggie\": \"broccoli\", \"_id\": \"testInsertJsonString\"}\n", null));
         Document b = testCollection.find(eq(MONGO_ID, "testInsertJsonString")).first();
-        assertNotNull("No record with 'testInsertJsonString' _id", b);
+        assertNotNull(b, "No record with 'testInsertJsonString' _id");
     }
 
     @Test
     public void testInsertJsonInputStreamWithSpaces() throws Exception {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         template.requestBody("direct:insertJsonString", IOConverter.toInputStream("    {\"test\": [\"test\"], \"_id\": \"testInsertJsonStringWithSpaces\"}\n", null));
         Document b = testCollection.find(eq(MONGO_ID, "testInsertJsonStringWithSpaces")).first();
-        assertNotNull("No record with 'testInsertJsonStringWithSpaces' _id", b);
+        assertNotNull(b, "No record with 'testInsertJsonStringWithSpaces' _id");
     }
 
     @Test
     public void testInsertBsonInputStream() {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
 
         Document document = new Document(MONGO_ID, "testInsertBsonString");
 
         // Object result =
         template.requestBody("direct:insertJsonString", new ByteArrayInputStream(document.toJson().getBytes()));
         Document b = testCollection.find(eq(MONGO_ID, "testInsertBsonString")).first();
-        assertNotNull("No record with 'testInsertBsonString' _id", b);
+        assertNotNull(b, "No record with 'testInsertBsonString' _id");
     }
 
     @Override
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbDynamicityTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbDynamicityTest.java
index baeda1e..46305a0 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbDynamicityTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbDynamicityTest.java
@@ -23,19 +23,24 @@ import java.util.stream.StreamSupport;
 import com.mongodb.client.MongoCollection;
 import org.apache.camel.builder.RouteBuilder;
 import org.bson.Document;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static com.mongodb.client.model.Filters.eq;
 import static org.apache.camel.component.mongodb.MongoDbConstants.MONGO_ID;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+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 MongoDbDynamicityTest extends AbstractMongoDbTest {
 
     @Test
     public void testInsertDynamicityDisabled() {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         mongo.getDatabase("otherDB").drop();
         db.getCollection("otherCollection").drop();
-        assertFalse("The otherDB database should not exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertFalse(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should not exist");
 
         String body = "{\"_id\": \"testInsertDynamicityDisabled\", \"a\" : \"1\"}";
         Map<String, Object> headers = new HashMap<>();
@@ -45,25 +50,25 @@ public class MongoDbDynamicityTest extends AbstractMongoDbTest {
         template.requestBodyAndHeaders("direct:noDynamicity", body, headers);
 
         Document b = testCollection.find(eq(MONGO_ID, "testInsertDynamicityDisabled")).first();
-        assertNotNull("No record with 'testInsertDynamicityDisabled' _id", b);
+        assertNotNull(b, "No record with 'testInsertDynamicityDisabled' _id");
 
         body = "{\"_id\": \"testInsertDynamicityDisabledExplicitly\", \"a\" : \"1\"}";
         // result =
         template.requestBodyAndHeaders("direct:noDynamicityExplicit", body, headers);
 
         b = testCollection.find(eq(MONGO_ID, "testInsertDynamicityDisabledExplicitly")).first();
-        assertNotNull("No record with 'testInsertDynamicityDisabledExplicitly' _id", b);
+        assertNotNull(b, "No record with 'testInsertDynamicityDisabledExplicitly' _id");
 
-        assertFalse("The otherDB database should not exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertFalse(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should not exist");
 
     }
 
     @Test
     public void testInsertDynamicityEnabledDBOnly() {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         mongo.getDatabase("otherDB").drop();
         db.getCollection("otherCollection").drop();
-        assertFalse("The otherDB database should not exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertFalse(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should not exist");
 
         String body = "{\"_id\": \"testInsertDynamicityEnabledDBOnly\", \"a\" : \"1\"}";
         Map<String, Object> headers = new HashMap<>();
@@ -74,21 +79,21 @@ public class MongoDbDynamicityTest extends AbstractMongoDbTest {
         MongoCollection<Document> localDynamicCollection = mongo.getDatabase("otherDB").getCollection(testCollection.getNamespace().getCollectionName(), Document.class);
 
         Document b = localDynamicCollection.find(eq(MONGO_ID, "testInsertDynamicityEnabledDBOnly")).first();
-        assertNotNull("No record with 'testInsertDynamicityEnabledDBOnly' _id", b);
+        assertNotNull(b, "No record with 'testInsertDynamicityEnabledDBOnly' _id");
 
         b = testCollection.find(eq(MONGO_ID, "testInsertDynamicityEnabledDBOnly")).first();
-        assertNull("There is a record with 'testInsertDynamicityEnabledDBOnly' _id in the test collection", b);
+        assertNull(b, "There is a record with 'testInsertDynamicityEnabledDBOnly' _id in the test collection");
 
-        assertTrue("The otherDB database should exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertTrue(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should exist");
 
     }
 
     @Test
     public void testInsertDynamicityEnabledCollectionOnly() {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         mongo.getDatabase("otherDB").drop();
         db.getCollection("otherCollection").drop();
-        assertFalse("The otherDB database should not exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertFalse(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should not exist");
 
         String body = "{\"_id\": \"testInsertDynamicityEnabledCollectionOnly\", \"a\" : \"1\"}";
         Map<String, Object> headers = new HashMap<>();
@@ -99,20 +104,20 @@ public class MongoDbDynamicityTest extends AbstractMongoDbTest {
         MongoCollection<Document> loaclDynamicCollection = db.getCollection("otherCollection", Document.class);
 
         Document b = loaclDynamicCollection.find(eq(MONGO_ID, "testInsertDynamicityEnabledCollectionOnly")).first();
-        assertNotNull("No record with 'testInsertDynamicityEnabledCollectionOnly' _id", b);
+        assertNotNull(b, "No record with 'testInsertDynamicityEnabledCollectionOnly' _id");
 
         b = testCollection.find(eq(MONGO_ID, "testInsertDynamicityEnabledDBOnly")).first();
-        assertNull("There is a record with 'testInsertDynamicityEnabledCollectionOnly' _id in the test collection", b);
+        assertNull(b, "There is a record with 'testInsertDynamicityEnabledCollectionOnly' _id in the test collection");
 
-        assertFalse("The otherDB database should not exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertFalse(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should not exist");
     }
 
     @Test
     public void testInsertDynamicityEnabledDBAndCollection() {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         mongo.getDatabase("otherDB").drop();
         db.getCollection("otherCollection").drop();
-        assertFalse("The otherDB database should not exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertFalse(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should not exist");
 
         String body = "{\"_id\": \"testInsertDynamicityEnabledDBAndCollection\", \"a\" : \"1\"}";
         Map<String, Object> headers = new HashMap<>();
@@ -124,12 +129,12 @@ public class MongoDbDynamicityTest extends AbstractMongoDbTest {
         MongoCollection<Document> loaclDynamicCollection = mongo.getDatabase("otherDB").getCollection("otherCollection", Document.class);
 
         Document b = loaclDynamicCollection.find(eq(MONGO_ID, "testInsertDynamicityEnabledDBAndCollection")).first();
-        assertNotNull("No record with 'testInsertDynamicityEnabledDBAndCollection' _id", b);
+        assertNotNull(b, "No record with 'testInsertDynamicityEnabledDBAndCollection' _id");
 
         b = testCollection.find(eq(MONGO_ID, "testInsertDynamicityEnabledDBOnly")).first();
-        assertNull("There is a record with 'testInsertDynamicityEnabledDBAndCollection' _id in the test collection", b);
+        assertNull(b, "There is a record with 'testInsertDynamicityEnabledDBAndCollection' _id in the test collection");
 
-        assertTrue("The otherDB database should exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertTrue(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should exist");
     }
 
     @Override
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbExceptionHandlingTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbExceptionHandlingTest.java
index c1908ae..ffd2b2a 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbExceptionHandlingTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbExceptionHandlingTest.java
@@ -19,14 +19,18 @@ package org.apache.camel.component.mongodb;
 import com.mongodb.DBObject;
 import org.apache.camel.builder.RouteBuilder;
 import org.bson.Document;
-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.fail;
 
 public class MongoDbExceptionHandlingTest extends AbstractMongoDbTest {
 
     @Test
     public void testInduceParseException() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         // notice missing quote at the end of Einstein
@@ -41,7 +45,7 @@ public class MongoDbExceptionHandlingTest extends AbstractMongoDbTest {
     @Test
     public void testInduceParseAndThenOkException() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         // notice missing quote at the end of Einstein
@@ -61,7 +65,7 @@ public class MongoDbExceptionHandlingTest extends AbstractMongoDbTest {
     @Test
     public void testErroneousDynamicOperation() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         try {
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbFindOperationTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbFindOperationTest.java
index 361064c..5dc1d85 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbFindOperationTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbFindOperationTest.java
@@ -27,21 +27,26 @@ import org.apache.commons.lang3.ObjectUtils;
 import org.bson.Document;
 import org.bson.conversions.Bson;
 import org.bson.types.ObjectId;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static com.mongodb.client.model.Filters.eq;
 import static org.apache.camel.component.mongodb.MongoDbConstants.MONGO_ID;
+import static org.apache.camel.test.junit5.TestSupport.assertListSize;
+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 MongoDbFindOperationTest extends AbstractMongoDbTest {
 
     @Test
     public void testFindAllNoCriteriaOperation() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         Object result = template.requestBody("direct:findAll", ObjectUtils.NULL);
-        assertTrue("Result is not of type List", result instanceof List);
+        assertTrue(result instanceof List, "Result is not of type List");
 
         @SuppressWarnings("unchecked")
         List<Document> resultList = (List<Document>)result;
@@ -50,27 +55,27 @@ public class MongoDbFindOperationTest extends AbstractMongoDbTest {
 
         // Ensure that all returned documents contain all fields
         for (Document document : resultList) {
-            assertNotNull("Document in returned list should contain all fields", document.get(MONGO_ID));
-            assertNotNull("Document in returned list should contain all fields", document.get("scientist"));
-            assertNotNull("Document in returned list should contain all fields", document.get("fixedField"));
+            assertNotNull(document.get(MONGO_ID), "Document in returned list should contain all fields");
+            assertNotNull(document.get("scientist"), "Document in returned list should contain all fields");
+            assertNotNull(document.get("fixedField"), "Document in returned list should contain all fields");
         }
 
         Exchange resultExchange = getMockEndpoint("mock:resultFindAll").getReceivedExchanges().get(0);
         // TODO: decide what to do with total count
         // assertEquals("Result total size header should equal 1000", 1000,
         // resultExchange.getIn().getHeader(MongoDbConstants.RESULT_TOTAL_SIZE));
-        assertEquals("Result page size header should equal 1000", 1000, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE));
+        assertEquals(1000, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE), "Result page size header should equal 1000");
 
     }
 
     @Test
     public void testFindAllWithQueryAndNoFIlter() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         Object result = template.requestBody("direct:findAll", eq("scientist", "Einstein"));
-        assertTrue("Result is not of type List", result instanceof List);
+        assertTrue(result instanceof List, "Result is not of type List");
 
         @SuppressWarnings("unchecked")
         List<Document> resultList = (List<Document>)result;
@@ -80,25 +85,25 @@ public class MongoDbFindOperationTest extends AbstractMongoDbTest {
         // Ensure that all returned documents contain all fields, and that they
         // only contain 'Einstein'
         for (Document document : resultList) {
-            assertNotNull("Document in returned list should not contain field _id", document.get(MONGO_ID));
-            assertNotNull("Document in returned list does not contain field 'scientist'", document.get("scientist"));
-            assertNotNull("Document in returned list should not contain field fixedField", document.get("fixedField"));
-            assertEquals("Document.scientist should only be Einstein", "Einstein", document.get("scientist"));
+            assertNotNull(document.get(MONGO_ID), "Document in returned list should not contain field _id");
+            assertNotNull(document.get("scientist"), "Document in returned list does not contain field 'scientist'");
+            assertNotNull(document.get("fixedField"), "Document in returned list should not contain field fixedField");
+            assertEquals("Einstein", document.get("scientist"), "Document.scientist should only be Einstein");
         }
 
         Exchange resultExchange = getMockEndpoint("mock:resultFindAll").getReceivedExchanges().get(0);
-        assertEquals("Result page size header should equal 100", 100, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE));
+        assertEquals(100, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE), "Result page size header should equal 100");
     }
 
     @Test
     public void testFindAllWithQueryAndFilter() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
         Bson fieldFilter = Projections.exclude(MONGO_ID, "fixedField");
         Bson query = eq("scientist", "Einstein");
         Object result = template.requestBodyAndHeader("direct:findAll", query, MongoDbConstants.FIELDS_PROJECTION, fieldFilter);
-        assertTrue("Result is not of type List", result instanceof List);
+        assertTrue(result instanceof List, "Result is not of type List");
 
         @SuppressWarnings("unchecked")
         List<Document> resultList = (List<Document>)result;
@@ -108,25 +113,25 @@ public class MongoDbFindOperationTest extends AbstractMongoDbTest {
         // Ensure that all returned documents contain all fields, and that they
         // only contain 'Einstein'
         for (Document document : resultList) {
-            assertNull("Document in returned list should not contain field _id", document.get(MONGO_ID));
-            assertNotNull("Document in returned list does not contain field 'scientist'", document.get("scientist"));
-            assertNull("Document in returned list should not contain field fixedField", document.get("fixedField"));
-            assertEquals("Document.scientist should only be Einstein", "Einstein", document.get("scientist"));
+            assertNull(document.get(MONGO_ID), "Document in returned list should not contain field _id");
+            assertNotNull(document.get("scientist"), "Document in returned list does not contain field 'scientist'");
+            assertNull(document.get("fixedField"), "Document in returned list should not contain field fixedField");
+            assertEquals("Einstein", document.get("scientist"), "Document.scientist should only be Einstein");
         }
 
         Exchange resultExchange = getMockEndpoint("mock:resultFindAll").getReceivedExchanges().get(0);
-        assertEquals("Result page size header should equal 100", 100, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE));
+        assertEquals(100, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE), "Result page size header should equal 100");
     }
 
     @Test
     public void testFindAllNoCriteriaWithFilterOperation() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         Bson fieldFilter = Projections.exclude(MONGO_ID, "fixedField");
         Object result = template.requestBodyAndHeader("direct:findAll", ObjectUtils.NULL, MongoDbConstants.FIELDS_PROJECTION, fieldFilter);
-        assertTrue("Result is not of type List", result instanceof List);
+        assertTrue(result instanceof List, "Result is not of type List");
 
         @SuppressWarnings("unchecked")
         List<Document> resultList = (List<Document>)result;
@@ -135,22 +140,22 @@ public class MongoDbFindOperationTest extends AbstractMongoDbTest {
 
         // Ensure that all returned documents contain all fields
         for (Document document : resultList) {
-            assertNull("Document in returned list should not contain field _id", document.get(MONGO_ID));
-            assertNotNull("Document in returned list does not contain field 'scientist'", document.get("scientist"));
-            assertNull("Document in returned list should not contain field fixedField", document.get("fixedField"));
+            assertNull(document.get(MONGO_ID), "Document in returned list should not contain field _id");
+            assertNotNull(document.get("scientist"), "Document in returned list does not contain field 'scientist'");
+            assertNull(document.get("fixedField"), "Document in returned list should not contain field fixedField");
         }
 
         Exchange resultExchange = getMockEndpoint("mock:resultFindAll").getReceivedExchanges().get(0);
         // assertEquals("Result total size header should equal 1000", 1000,
         // resultExchange.getIn().getHeader(MongoDbConstants.RESULT_TOTAL_SIZE));
-        assertEquals("Result page size header should equal 1000", 1000, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE));
+        assertEquals(1000, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE), "Result page size header should equal 1000");
 
     }
 
     @Test
     public void testFindAllIterationOperation() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         // Repeat ten times, obtain 10 batches of 100 results each time
@@ -161,19 +166,19 @@ public class MongoDbFindOperationTest extends AbstractMongoDbTest {
             headers.put(MongoDbConstants.NUM_TO_SKIP, numToSkip);
             headers.put(MongoDbConstants.LIMIT, 100);
             Object result = template.requestBodyAndHeaders("direct:findAll", ObjectUtils.NULL, headers);
-            assertTrue("Result is not of type List", result instanceof List);
+            assertTrue(result instanceof List, "Result is not of type List");
 
             @SuppressWarnings("unchecked")
             List<Document> resultList = (List<Document>)result;
 
             assertListSize("Result does not contain 100 elements", resultList, 100);
-            assertEquals("Id of first record is not as expected", numToSkip + 1, Integer.parseInt((String)resultList.get(0).get(MONGO_ID)));
+            assertEquals(numToSkip + 1, Integer.parseInt((String)resultList.get(0).get(MONGO_ID)), "Id of first record is not as expected");
 
             // Ensure that all returned documents contain all fields
             for (Document document : resultList) {
-                assertNotNull("Document in returned list should contain all fields", document.get(MONGO_ID));
-                assertNotNull("Document in returned list should contain all fields", document.get("scientist"));
-                assertNotNull("Document in returned list should contain all fields", document.get("fixedField"));
+                assertNotNull(document.get(MONGO_ID), "Document in returned list should contain all fields");
+                assertNotNull(document.get("scientist"), "Document in returned list should contain all fields");
+                assertNotNull(document.get("fixedField"), "Document in returned list should contain all fields");
             }
 
             numToSkip = numToSkip + limit;
@@ -183,18 +188,18 @@ public class MongoDbFindOperationTest extends AbstractMongoDbTest {
             // TODO: decide what to do with the total number of elements
             // assertEquals("Result total size header should equal 1000", 1000,
             // resultExchange.getIn().getHeader(MongoDbConstants.RESULT_TOTAL_SIZE));
-            assertEquals("Result page size header should equal 100", 100, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE));
+            assertEquals(100, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE), "Result page size header should equal 100");
         }
     }
 
     @Test
     public void testFindDistinctNoQuery() {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         Object result = template.requestBodyAndHeader("direct:findDistinct", null, MongoDbConstants.DISTINCT_QUERY_FIELD, "scientist");
-        assertTrue("Result is not of type List", result instanceof List);
+        assertTrue(result instanceof List, "Result is not of type List");
 
         @SuppressWarnings("unchecked")
         List<String> resultList = (List<String>)result;
@@ -204,13 +209,13 @@ public class MongoDbFindOperationTest extends AbstractMongoDbTest {
     @Test
     public void testFindDistinctWithQuery() {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         Bson query = eq("scientist", "Einstein");
 
         Object result = template.requestBodyAndHeader("direct:findDistinct", query, MongoDbConstants.DISTINCT_QUERY_FIELD, "scientist");
-        assertTrue("Result is not of type List", result instanceof List);
+        assertTrue(result instanceof List, "Result is not of type List");
 
         @SuppressWarnings("unchecked")
         List<String> resultList = (List<String>)result;
@@ -222,55 +227,55 @@ public class MongoDbFindOperationTest extends AbstractMongoDbTest {
     @Test
     public void testFindOneByQuery() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         Bson query = eq("scientist", "Einstein");
         Document result = template.requestBody("direct:findOneByQuery", query, Document.class);
-        assertTrue("Result is not of type Document", result instanceof Document);
+        assertTrue(result instanceof Document, "Result is not of type Document");
 
-        assertNotNull("Document in returned list should contain all fields", result.get(MONGO_ID));
-        assertNotNull("Document in returned list should contain all fields", result.get("scientist"));
-        assertNotNull("Document in returned list should contain all fields", result.get("fixedField"));
+        assertNotNull(result.get(MONGO_ID), "Document in returned list should contain all fields");
+        assertNotNull(result.get("scientist"), "Document in returned list should contain all fields");
+        assertNotNull(result.get("fixedField"), "Document in returned list should contain all fields");
 
     }
 
     @Test
     public void testFindOneById() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         Document result = template.requestBody("direct:findById", "240", Document.class);
-        assertTrue("Result is not of type Document", result instanceof Document);
+        assertTrue(result instanceof Document, "Result is not of type Document");
 
-        assertEquals("The ID of the retrieved Document should equal 240", "240", result.get(MONGO_ID));
-        assertEquals("The scientist name of the retrieved Document should equal Einstein", "Einstein", result.get("scientist"));
+        assertEquals("240", result.get(MONGO_ID), "The ID of the retrieved Document should equal 240");
+        assertEquals("Einstein", result.get("scientist"), "The scientist name of the retrieved Document should equal Einstein");
 
-        assertNotNull("Document in returned list should contain all fields", result.get(MONGO_ID));
-        assertNotNull("Document in returned list should contain all fields", result.get("scientist"));
-        assertNotNull("Document in returned list should contain all fields", result.get("fixedField"));
+        assertNotNull(result.get(MONGO_ID), "Document in returned list should contain all fields");
+        assertNotNull(result.get("scientist"), "Document in returned list should contain all fields");
+        assertNotNull(result.get("fixedField"), "Document in returned list should contain all fields");
 
     }
 
     @Test
     public void testFindOneByIdWithObjectId() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         Document insertObject = new Document("scientist", "Einstein");
         testCollection.insertOne(insertObject);
-        assertTrue("The ID of the inserted document should be ObjectId", insertObject.get(MONGO_ID) instanceof ObjectId);
+        assertTrue(insertObject.get(MONGO_ID) instanceof ObjectId, "The ID of the inserted document should be ObjectId");
         ObjectId id = insertObject.getObjectId(MONGO_ID);
 
         Document result = template.requestBody("direct:findById", id, Document.class);
-        assertTrue("Result is not of type Document", result instanceof Document);
+        assertTrue(result instanceof Document, "Result is not of type Document");
 
-        assertTrue("The ID of the retrieved Document should be ObjectId", result.get(MONGO_ID) instanceof ObjectId);
-        assertEquals("The ID of the retrieved Document should equal to the inserted", id, result.get(MONGO_ID));
-        assertEquals("The scientist name of the retrieved Document should equal Einstein", "Einstein", result.get("scientist"));
+        assertTrue(result.get(MONGO_ID) instanceof ObjectId, "The ID of the retrieved Document should be ObjectId");
+        assertEquals(id, result.get(MONGO_ID), "The ID of the retrieved Document should equal to the inserted");
+        assertEquals("Einstein", result.get("scientist"), "The scientist name of the retrieved Document should equal Einstein");
 
-        assertNotNull("Document in returned list should contain all fields", result.get(MONGO_ID));
-        assertNotNull("Document in returned list should contain all fields", result.get("scientist"));
+        assertNotNull(result.get(MONGO_ID), "Document in returned list should contain all fields");
+        assertNotNull(result.get("scientist"), "Document in returned list should contain all fields");
 
     }
 
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbHeaderHandlingTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbHeaderHandlingTest.java
index ee388c6..ce98615 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbHeaderHandlingTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbHeaderHandlingTest.java
@@ -21,17 +21,21 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.bson.Document;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static com.mongodb.client.model.Filters.eq;
 import static org.apache.camel.component.mongodb.MongoDbConstants.MONGO_ID;
+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 MongoDbHeaderHandlingTest extends AbstractMongoDbTest {
 
     @Test
     public void testInHeadersTransferredToOutOnCount() {
         // a read operation
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         Exchange result = template.request("direct:count", new Processor() {
             @Override
             public void process(Exchange exchange) throws Exception {
@@ -39,9 +43,9 @@ public class MongoDbHeaderHandlingTest extends AbstractMongoDbTest {
                 exchange.getIn().setHeader("abc", "def");
             }
         });
-        assertTrue("Result is not of type Long", result.getOut().getBody() instanceof Long);
-        assertEquals("Test collection should not contain any records", 0L, result.getOut().getBody());
-        assertEquals("An input header was not returned", "def", result.getOut().getHeader("abc"));
+        assertTrue(result.getMessage().getBody() instanceof Long, "Result is not of type Long");
+        assertEquals(0L, result.getMessage().getBody(), "Test collection should not contain any records");
+        assertEquals("def", result.getMessage().getHeader("abc"), "An input header was not returned");
     }
 
     @Test
@@ -56,25 +60,25 @@ public class MongoDbHeaderHandlingTest extends AbstractMongoDbTest {
 
         // TODO: WriteResult isn't return when inserting
         // assertTrue(result.getOut().getBody() instanceof WriteResult);
-        assertEquals("An input header was not returned", "def", result.getOut().getHeader("abc"));
+        assertEquals("def", result.getMessage().getHeader("abc"), "An input header was not returned");
         Document b = testCollection.find(eq(MONGO_ID, "testInsertString")).first();
-        assertNotNull("No record with 'testInsertString' _id", b);
+        assertNotNull(b, "No record with 'testInsertString' _id");
     }
 
     @Test
     public void testWriteResultAsHeaderWithWriteOp() {
         // Prepare test
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         Object[] req = new Object[] {new Document(MONGO_ID, "testSave1").append("scientist", "Einstein").toJson(),
                                      new Document(MONGO_ID, "testSave2").append("scientist", "Copernicus").toJson()};
         // Object result =
         template.requestBody("direct:insert", req);
         // assertTrue(result instanceof WriteResult);
-        assertEquals("Number of records persisted must be 2", 2, testCollection.count());
+        assertEquals(2, testCollection.countDocuments(), "Number of records persisted must be 2");
 
         // Testing the save logic
         final Document record1 = testCollection.find(eq(MONGO_ID, "testSave1")).first();
-        assertEquals("Scientist field of 'testSave1' must equal 'Einstein'", "Einstein", record1.get("scientist"));
+        assertEquals("Einstein", record1.get("scientist"), "Scientist field of 'testSave1' must equal 'Einstein'");
         record1.put("scientist", "Darwin");
 
         // test that as a payload, we get back exactly our input, but enriched
@@ -85,12 +89,12 @@ public class MongoDbHeaderHandlingTest extends AbstractMongoDbTest {
                 exchange.getIn().setBody(record1);
             }
         });
-        assertTrue(resultExch.getOut().getBody() instanceof Document);
-        assertTrue(resultExch.getOut().getBody().equals(record1));
-        assertTrue(resultExch.getOut().getHeader(MongoDbConstants.WRITERESULT) instanceof UpdateResult);
+        assertTrue(resultExch.getMessage().getBody() instanceof Document);
+        assertTrue(resultExch.getMessage().getBody().equals(record1));
+        assertTrue(resultExch.getMessage().getHeader(MongoDbConstants.WRITERESULT) instanceof UpdateResult);
 
         Document record2 = testCollection.find(eq(MONGO_ID, "testSave1")).first();
-        assertEquals("Scientist field of 'testSave1' must equal 'Darwin' after save operation", "Darwin", record2.get("scientist"));
+        assertEquals("Darwin", record2.get("scientist"), "Scientist field of 'testSave1' must equal 'Darwin' after save operation");
 
     }
 
@@ -103,9 +107,9 @@ public class MongoDbHeaderHandlingTest extends AbstractMongoDbTest {
                 exchange.getIn().setHeader("abc", "def");
             }
         });
-        assertTrue(resultExch.getOut().getBody() instanceof Document);
-        assertNull(resultExch.getOut().getHeader(MongoDbConstants.WRITERESULT));
-        assertEquals("def", resultExch.getOut().getHeader("abc"));
+        assertTrue(resultExch.getMessage().getBody() instanceof Document);
+        assertNull(resultExch.getMessage().getHeader(MongoDbConstants.WRITERESULT));
+        assertEquals("def", resultExch.getMessage().getHeader("abc"));
     }
 
     @Override
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbIndexTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbIndexTest.java
index 8fe7b1f..dc1c477 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbIndexTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbIndexTest.java
@@ -30,22 +30,27 @@ import com.mongodb.client.MongoCursor;
 import org.apache.camel.builder.RouteBuilder;
 import org.bson.Document;
 import org.bson.conversions.Bson;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
 import static com.mongodb.client.model.Filters.eq;
 import static com.mongodb.client.model.Indexes.ascending;
 import static com.mongodb.client.model.Indexes.descending;
 import static org.apache.camel.component.mongodb.MongoDbConstants.MONGO_ID;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+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 MongoDbIndexTest extends AbstractMongoDbTest {
 
     @Test
     public void testInsertDynamicityEnabledDBAndCollectionAndIndex() {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         mongo.getDatabase("otherDB").drop();
         db.getCollection("otherCollection").drop();
-        assertFalse("The otherDB database should not exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertFalse(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should not exist");
 
         String body = "{\"_id\": \"testInsertDynamicityEnabledDBAndCollection\", \"a\" : 1, \"b\" : 2}";
         Map<String, Object> headers = new HashMap<>();
@@ -64,7 +69,7 @@ public class MongoDbIndexTest extends AbstractMongoDbTest {
 
         Object result = template.requestBodyAndHeaders("direct:dynamicityEnabled", body, headers);
 
-        assertEquals("Response isn't of type WriteResult", Document.class, result.getClass());
+        assertEquals(Document.class, result.getClass(), "Response isn't of type WriteResult");
 
         MongoCollection<Document> localDynamicCollection = mongo.getDatabase("otherDB").getCollection("otherCollection", Document.class);
 
@@ -75,24 +80,24 @@ public class MongoDbIndexTest extends AbstractMongoDbTest {
         Document key1 = iterator.next().get("key", Document.class);
         Document key2 = iterator.next().get("key", Document.class);
 
-        assertTrue("No index on the field a", key1.containsKey("a") && 1 == key1.getInteger("a"));
-        assertTrue("No index on the field b", key2.containsKey("b") && -1 == key2.getInteger("b"));
+        assertTrue(key1.containsKey("a") && 1 == key1.getInteger("a"), "No index on the field a");
+        assertTrue(key2.containsKey("b") && -1 == key2.getInteger("b"), "No index on the field b");
 
         Document b = localDynamicCollection.find(new Document(MONGO_ID, "testInsertDynamicityEnabledDBAndCollection")).first();
-        assertNotNull("No record with 'testInsertDynamicityEnabledDBAndCollection' _id", b);
+        assertNotNull(b, "No record with 'testInsertDynamicityEnabledDBAndCollection' _id");
 
         b = testCollection.find(new Document(MONGO_ID, "testInsertDynamicityEnabledDBOnly")).first();
-        assertNull("There is a record with 'testInsertDynamicityEnabledDBAndCollection' _id in the test collection", b);
+        assertNull(b, "There is a record with 'testInsertDynamicityEnabledDBAndCollection' _id in the test collection");
 
-        assertTrue("The otherDB database should exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertTrue(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should exist");
     }
 
     @Test
     public void testInsertDynamicityEnabledCollectionAndIndex() {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         mongo.getDatabase("otherDB").drop();
         db.getCollection("otherCollection").drop();
-        assertFalse("The otherDB database should not exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertFalse(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should not exist");
 
         String body = "{\"_id\": \"testInsertDynamicityEnabledCollectionAndIndex\", \"a\" : 1, \"b\" : 2}";
         Map<String, Object> headers = new HashMap<>();
@@ -103,7 +108,7 @@ public class MongoDbIndexTest extends AbstractMongoDbTest {
 
         Object result = template.requestBodyAndHeaders("direct:dynamicityEnabled", body, headers);
 
-        assertEquals("Response isn't of type WriteResult", Document.class, result.getClass());
+        assertEquals(Document.class, result.getClass(), "Response isn't of type WriteResult");
 
         MongoCollection<Document> localDynamicCollection = db.getCollection("otherCollection", Document.class);
 
@@ -113,24 +118,24 @@ public class MongoDbIndexTest extends AbstractMongoDbTest {
         Document key1 = indexInfos.next().get("key", Document.class);
         Document key2 = indexInfos.next().get("key", Document.class);
 
-        assertTrue("No index on the field a", key1.containsKey("a") && 1 == key1.getInteger("a"));
-        assertTrue("No index on the field b", key2.containsKey("b") && -1 == key2.getInteger("b"));
+        assertTrue(key1.containsKey("a") && 1 == key1.getInteger("a"), "No index on the field a");
+        assertTrue(key2.containsKey("b") && -1 == key2.getInteger("b"), "No index on the field b");
 
         Document b = localDynamicCollection.find(eq(MONGO_ID, "testInsertDynamicityEnabledCollectionAndIndex")).first();
-        assertNotNull("No record with 'testInsertDynamicityEnabledCollectionAndIndex' _id", b);
+        assertNotNull(b, "No record with 'testInsertDynamicityEnabledCollectionAndIndex' _id");
 
         b = testCollection.find(eq(MONGO_ID, "testInsertDynamicityEnabledDBOnly")).first();
-        assertNull("There is a record with 'testInsertDynamicityEnabledDBAndCollection' _id in the test collection", b);
+        assertNull(b, "There is a record with 'testInsertDynamicityEnabledDBAndCollection' _id in the test collection");
 
-        assertFalse("The otherDB database should not exist", mongo.getUsedDatabases().contains("otherDB"));
+        assertFalse(mongo.getUsedDatabases().contains("otherDB"), "The otherDB database should not exist");
     }
 
     @Test
     public void testInsertDynamicityEnabledCollectionOnlyAndURIIndex() {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         mongo.getDatabase("otherDB").drop();
         db.getCollection("otherCollection").drop();
-        assertFalse("The otherDB database should not exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertFalse(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should not exist");
 
         String body = "{\"_id\": \"testInsertDynamicityEnabledCollectionOnlyAndURIIndex\", \"a\" : 1, \"b\" : 2}";
         Map<String, Object> headers = new HashMap<>();
@@ -138,7 +143,7 @@ public class MongoDbIndexTest extends AbstractMongoDbTest {
 
         Object result = template.requestBodyAndHeaders("direct:dynamicityEnabledWithIndexUri", body, headers);
 
-        assertEquals("Response isn't of type WriteResult", Document.class, result.getClass());
+        assertEquals(Document.class, result.getClass(), "Response isn't of type WriteResult");
 
         MongoCollection<Document> localDynamicCollection = db.getCollection("otherCollection", Document.class);
 
@@ -146,28 +151,28 @@ public class MongoDbIndexTest extends AbstractMongoDbTest {
 
         Document key1 = indexInfos.next().get("key", Document.class);
 
-        assertFalse("No index on the field a", key1.containsKey("a") && "-1".equals(key1.getString("a")));
+        assertFalse(key1.containsKey("a") && "-1".equals(key1.getString("a")), "No index on the field a");
 
         Document b = localDynamicCollection.find(eq(MONGO_ID, "testInsertDynamicityEnabledCollectionOnlyAndURIIndex")).first();
-        assertNotNull("No record with 'testInsertDynamicityEnabledCollectionOnlyAndURIIndex' _id", b);
+        assertNotNull(b, "No record with 'testInsertDynamicityEnabledCollectionOnlyAndURIIndex' _id");
 
         b = testCollection.find(eq(MONGO_ID, "testInsertDynamicityEnabledCollectionOnlyAndURIIndex")).first();
-        assertNull("There is a record with 'testInsertDynamicityEnabledCollectionOnlyAndURIIndex' _id in the test collection", b);
+        assertNull(b, "There is a record with 'testInsertDynamicityEnabledCollectionOnlyAndURIIndex' _id in the test collection");
 
-        assertFalse("The otherDB database should not exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertFalse(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should not exist");
     }
 
-    @Ignore
+    @Disabled
     @Test
     public void testInsertAutoCreateCollectionAndURIIndex() {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         db.getCollection("otherCollection").deleteOne(new Document());
 
         String body = "{\"_id\": \"testInsertAutoCreateCollectionAndURIIndex\", \"a\" : 1, \"b\" : 2}";
         Map<String, Object> headers = new HashMap<>();
 
         Object result = template.requestBodyAndHeaders("direct:dynamicityDisabled", body, headers);
-        assertEquals("Response isn't of type WriteResult", WriteResult.class, result.getClass());
+        assertEquals(WriteResult.class, result.getClass(), "Response isn't of type WriteResult");
 
         MongoCollection<Document> collection = db.getCollection("otherCollection", Document.class);
         MongoCursor<Document> indexInfos = collection.listIndexes().iterator();
@@ -175,16 +180,16 @@ public class MongoDbIndexTest extends AbstractMongoDbTest {
         Document key1 = indexInfos.next().get("key", Document.class);
         Document key2 = indexInfos.next().get("key", Document.class);
 
-        assertTrue("No index on the field b", key1.containsKey("b") && "-1".equals(key1.getString("b")));
-        assertTrue("No index on the field a", key2.containsKey("a") && "1".equals(key2.getString("a")));
+        assertTrue(key1.containsKey("b") && "-1".equals(key1.getString("b")), "No index on the field b");
+        assertTrue(key2.containsKey("a") && "1".equals(key2.getString("a")), "No index on the field a");
 
         Document b = collection.find(eq(MONGO_ID, "testInsertAutoCreateCollectionAndURIIndex")).first();
-        assertNotNull("No record with 'testInsertAutoCreateCollectionAndURIIndex' _id", b);
+        assertNotNull(b, "No record with 'testInsertAutoCreateCollectionAndURIIndex' _id");
 
         b = testCollection.find(eq(MONGO_ID, "testInsertAutoCreateCollectionAndURIIndex")).first();
-        assertNull("There is a record with 'testInsertAutoCreateCollectionAndURIIndex' _id in the test collection", b);
+        assertNull(b, "There is a record with 'testInsertAutoCreateCollectionAndURIIndex' _id in the test collection");
 
-        assertFalse("The otherDB database should not exist", StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals));
+        assertFalse(StreamSupport.stream(mongo.listDatabaseNames().spliterator(), false).anyMatch("otherDB"::equals), "The otherDB database should not exist");
     }
 
     @Override
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOperationsTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOperationsTest.java
index a4b8918..1d0a0ac 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOperationsTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOperationsTest.java
@@ -31,7 +31,7 @@ import org.apache.camel.builder.RouteBuilder;
 import org.bson.Document;
 import org.bson.conversions.Bson;
 import org.bson.types.ObjectId;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static com.mongodb.client.model.Accumulators.sum;
 import static com.mongodb.client.model.Aggregates.group;
@@ -43,39 +43,44 @@ import static com.mongodb.client.model.Updates.currentTimestamp;
 import static com.mongodb.client.model.Updates.set;
 import static java.util.Arrays.asList;
 import static org.apache.camel.component.mongodb.MongoDbConstants.MONGO_ID;
+import static org.apache.camel.test.junit5.TestSupport.assertListSize;
+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 MongoDbOperationsTest extends AbstractMongoDbTest {
 
     @Test
     public void testCountOperation() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         Object result = template.requestBody("direct:count", "irrelevantBody");
-        assertTrue("Result is not of type Long", result instanceof Long);
-        assertEquals("Test collection should not contain any records", 0L, result);
+        assertTrue(result instanceof Long, "Result is not of type Long");
+        assertEquals(0L, result, "Test collection should not contain any records");
 
         // Insert a record and test that the endpoint now returns 1
         testCollection.insertOne(Document.parse("{a:60}"));
         result = template.requestBody("direct:count", "irrelevantBody");
-        assertTrue("Result is not of type Long", result instanceof Long);
-        assertEquals("Test collection should contain 1 record", 1L, result);
+        assertTrue(result instanceof Long, "Result is not of type Long");
+        assertEquals(1L, result, "Test collection should contain 1 record");
         testCollection.deleteOne(new Document());
 
         // test dynamicity
         dynamicCollection.insertOne(Document.parse("{a:60}"));
         result = template.requestBodyAndHeader("direct:count", "irrelevantBody", MongoDbConstants.COLLECTION, dynamicCollectionName);
-        assertTrue("Result is not of type Long", result instanceof Long);
-        assertEquals("Dynamic collection should contain 1 record", 1L, result);
+        assertTrue(result instanceof Long, "Result is not of type Long");
+        assertEquals(1L, result, "Dynamic collection should contain 1 record");
 
     }
 
     @Test
     public void testInsertString() throws Exception {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         Object result = template.requestBody("direct:insert", new Document(MONGO_ID, "testInsertString").append("scientist", "Einstein").toJson());
         assertTrue(result instanceof Document);
         Document b = testCollection.find(eq(MONGO_ID, "testInsertString")).first();
-        assertNotNull("No record with 'testInsertString' _id", b);
+        assertNotNull(b, "No record with 'testInsertString' _id");
     }
 
     @Test
@@ -97,30 +102,30 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
     @Test
     public void testSave() throws Exception {
         // Prepare test
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         Object[] req = new Object[] {new Document(MONGO_ID, "testSave1").append("scientist", "Einstein").toJson(),
                                      new Document(MONGO_ID, "testSave2").append("scientist", "Copernicus").toJson()};
         Object result = template.requestBody("direct:insert", req);
         assertTrue(result instanceof List);
-        assertEquals("Number of records persisted must be 2", 2, testCollection.count());
+        assertEquals(2, testCollection.countDocuments(), "Number of records persisted must be 2");
 
         // Testing the save logic
         Document record1 = testCollection.find(eq(MONGO_ID, "testSave1")).first();
-        assertEquals("Scientist field of 'testSave1' must equal 'Einstein'", "Einstein", record1.get("scientist"));
+        assertEquals("Einstein", record1.get("scientist"), "Scientist field of 'testSave1' must equal 'Einstein'");
         record1.put("scientist", "Darwin");
 
         result = template.requestBody("direct:save", record1);
         assertTrue(result instanceof UpdateResult);
 
         record1 = testCollection.find(eq(MONGO_ID, "testSave1")).first();
-        assertEquals("Scientist field of 'testSave1' must equal 'Darwin' after save operation", "Darwin", record1.get("scientist"));
+        assertEquals("Darwin", record1.get("scientist"), "Scientist field of 'testSave1' must equal 'Darwin' after save operation");
 
     }
 
     @Test
     public void testSaveWithoutId() {
         // Prepare test
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         // This document should not be modified
         Document doc = new Document("scientist", "Copernic");
         template.requestBody("direct:insert", doc);
@@ -133,7 +138,7 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
         assertEquals(0, result.getModifiedCount());
         // Testing the save logic
         Document record1 = testCollection.find(eq(MONGO_ID, result.getUpsertedId())).first();
-        assertEquals("Scientist field of '" + result.getUpsertedId() + "' must equal 'Einstein'", "Einstein", record1.get("scientist"));
+        assertEquals("Einstein", record1.get("scientist"), "Scientist field of '" + result.getUpsertedId() + "' must equal 'Einstein'");
     }
 
     @Test
@@ -153,7 +158,7 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
     @Test
     public void testUpdate() throws Exception {
         // Prepare test
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         for (int i = 1; i <= 100; i++) {
             String body = null;
             try (Formatter f = new Formatter();) {
@@ -166,12 +171,12 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
             }
             template.requestBody("direct:insert", body);
         }
-        assertEquals(100L, testCollection.count());
+        assertEquals(100L, testCollection.countDocuments());
 
         // Testing the update logic
         Bson extraField = eq("extraField", true);
-        assertEquals("Number of records with 'extraField' flag on must equal 50", 50L, testCollection.count(extraField));
-        assertEquals("Number of records with 'scientist' field = Darwin on must equal 0", 0, testCollection.count(new Document("scientist", "Darwin")));
+        assertEquals(50L, testCollection.countDocuments(extraField), "Number of records with 'extraField' flag on must equal 50");
+        assertEquals(0, testCollection.countDocuments(new Document("scientist", "Darwin")), "Number of records with 'scientist' field = Darwin on must equal 0");
 
         Bson updateObj = combine(set("scientist", "Darwin"), currentTimestamp("lastModified"));
 
@@ -182,17 +187,17 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
                 exchange.getIn().setHeader(MongoDbConstants.MULTIUPDATE, true);
             }
         });
-        Object result = resultExchange.getOut().getBody();
+        Object result = resultExchange.getMessage().getBody();
         assertTrue(result instanceof UpdateResult);
-        assertEquals("Number of records updated header should equal 50", 50L, resultExchange.getOut().getHeader(MongoDbConstants.RECORDS_AFFECTED));
+        assertEquals(50L, resultExchange.getMessage().getHeader(MongoDbConstants.RECORDS_AFFECTED), "Number of records updated header should equal 50");
 
-        assertEquals("Number of records with 'scientist' field = Darwin on must equal 50 after update", 50, testCollection.count(new Document("scientist", "Darwin")));
+        assertEquals(50, testCollection.countDocuments(new Document("scientist", "Darwin")), "Number of records with 'scientist' field = Darwin on must equal 50 after update");
     }
 
     @Test
     public void testUpdateFromString() throws Exception {
         // Prepare test
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         for (int i = 1; i <= 100; i++) {
             String body = null;
             try (Formatter f = new Formatter();) {
@@ -205,12 +210,12 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
             }
             template.requestBody("direct:insert", body);
         }
-        assertEquals(100L, testCollection.count());
+        assertEquals(100L, testCollection.countDocuments());
 
         // Testing the update logic
         Bson extraField = eq("extraField", true);
-        assertEquals("Number of records with 'extraField' flag on must equal 50", 50L, testCollection.count(extraField));
-        assertEquals("Number of records with 'scientist' field = Darwin on must equal 0", 0, testCollection.count(new Document("scientist", "Darwin")));
+        assertEquals(50L, testCollection.countDocuments(extraField), "Number of records with 'extraField' flag on must equal 50");
+        assertEquals(0, testCollection.countDocuments(new Document("scientist", "Darwin")), "Number of records with 'scientist' field = Darwin on must equal 0");
 
         Bson updateObj = combine(set("scientist", "Darwin"), currentTimestamp("lastModified"));
 
@@ -224,17 +229,17 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
                 exchange.getIn().setHeader(MongoDbConstants.MULTIUPDATE, true);
             }
         });
-        Object result = resultExchange.getOut().getBody();
+        Object result = resultExchange.getMessage().getBody();
         assertTrue(result instanceof UpdateResult);
-        assertEquals("Number of records updated header should equal 50", 50L, resultExchange.getOut().getHeader(MongoDbConstants.RECORDS_AFFECTED));
+        assertEquals(50L, resultExchange.getMessage().getHeader(MongoDbConstants.RECORDS_AFFECTED), "Number of records updated header should equal 50");
 
-        assertEquals("Number of records with 'scientist' field = Darwin on must equal 50 after update", 50, testCollection.count(new Document("scientist", "Darwin")));
+        assertEquals(50, testCollection.countDocuments(new Document("scientist", "Darwin")), "Number of records with 'scientist' field = Darwin on must equal 50 after update");
     }
 
     @Test
     public void testUpdateUsingFieldsFilterHeader() throws Exception {
         // Prepare test
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         for (int i = 1; i <= 100; i++) {
             String body = null;
             try (Formatter f = new Formatter();) {
@@ -247,12 +252,12 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
             }
             template.requestBody("direct:insert", body);
         }
-        assertEquals(100L, testCollection.count());
+        assertEquals(100L, testCollection.countDocuments());
 
         // Testing the update logic
         Bson extraField = eq("extraField", true);
-        assertEquals("Number of records with 'extraField' flag on must equal 50", 50L, testCollection.count(extraField));
-        assertEquals("Number of records with 'scientist' field = Darwin on must equal 0", 0, testCollection.count(new Document("scientist", "Darwin")));
+        assertEquals(50L, testCollection.countDocuments(extraField), "Number of records with 'extraField' flag on must equal 50");
+        assertEquals(0, testCollection.countDocuments(new Document("scientist", "Darwin")), "Number of records with 'scientist' field = Darwin on must equal 0");
 
         Bson updateObj = combine(set("scientist", "Darwin"), currentTimestamp("lastModified"));
         HashMap<String, Object> headers = new HashMap<>();
@@ -260,14 +265,14 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
         headers.put(MongoDbConstants.CRITERIA, extraField);
         Object result = template.requestBodyAndHeaders("direct:update", updateObj, headers);
         assertTrue(result instanceof UpdateResult);
-        assertEquals("Number of records updated header should equal 50", 50L, UpdateResult.class.cast(result).getModifiedCount());
-        assertEquals("Number of records with 'scientist' field = Darwin on must equal 50 after update", 50, testCollection.count(new Document("scientist", "Darwin")));
+        assertEquals(50L, UpdateResult.class.cast(result).getModifiedCount(), "Number of records updated header should equal 50");
+        assertEquals(50, testCollection.countDocuments(new Document("scientist", "Darwin")), "Number of records with 'scientist' field = Darwin on must equal 50 after update");
     }
 
     @Test
     public void testRemove() throws Exception {
         // Prepare test
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         for (int i = 1; i <= 100; i++) {
             String body = null;
             try (Formatter f = new Formatter()) {
@@ -280,11 +285,11 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
             }
             template.requestBody("direct:insert", body);
         }
-        assertEquals(100L, testCollection.count());
+        assertEquals(100L, testCollection.countDocuments());
 
         // Testing the update logic
         Bson extraField = Filters.eq("extraField", true);
-        assertEquals("Number of records with 'extraField' flag on must equal 50", 50L, testCollection.count(extraField));
+        assertEquals(50L, testCollection.countDocuments(extraField), "Number of records with 'extraField' flag on must equal 50");
 
         Exchange resultExchange = template.request("direct:remove", new Processor() {
             @Override
@@ -292,24 +297,24 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
                 exchange.getIn().setBody(extraField);
             }
         });
-        Object result = resultExchange.getOut().getBody();
+        Object result = resultExchange.getMessage().getBody();
         assertTrue(result instanceof DeleteResult);
-        assertEquals("Number of records deleted header should equal 50", 50L, resultExchange.getOut().getHeader(MongoDbConstants.RECORDS_AFFECTED));
+        assertEquals(50L, resultExchange.getMessage().getHeader(MongoDbConstants.RECORDS_AFFECTED), "Number of records deleted header should equal 50");
 
-        assertEquals("Number of records with 'extraField' flag on must be 0 after remove", 0, testCollection.count(extraField));
+        assertEquals(0, testCollection.countDocuments(extraField), "Number of records with 'extraField' flag on must be 0 after remove");
 
     }
 
     @Test
     public void testAggregate() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
 
         // Repeat ten times, obtain 10 batches of 100 results each time
         List<Bson> aggregate = Arrays.asList(match(or(eq("scientist", "Darwin"), eq("scientist", "Einstein"))), group("$scientist", sum("count", 1)));
         Object result = template.requestBody("direct:aggregate", aggregate);
-        assertTrue("Result is not of type List", result instanceof List);
+        assertTrue(result instanceof List, "Result is not of type List");
 
         @SuppressWarnings("unchecked")
         List<Document> resultList = (List<Document>)result;
@@ -319,15 +324,15 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
 
     @Test
     public void testDbStats() throws Exception {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         Object result = template.requestBody("direct:getDbStats", "irrelevantBody");
-        assertTrue("Result is not of type Document", result instanceof Document);
-        assertTrue("The result should contain keys", Document.class.cast(result).keySet().size() > 0);
+        assertTrue(result instanceof Document, "Result is not of type Document");
+        assertTrue(Document.class.cast(result).keySet().size() > 0, "The result should contain keys");
     }
 
     @Test
     public void testColStats() throws Exception {
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
 
         // Add some records to the collection (and do it via camel-mongodb)
         for (int i = 1; i <= 100; i++) {
@@ -340,34 +345,34 @@ public class MongoDbOperationsTest extends AbstractMongoDbTest {
         }
 
         Object result = template.requestBody("direct:getColStats", "irrelevantBody");
-        assertTrue("Result is not of type Document", result instanceof Document);
-        assertTrue("The result should contain keys", Document.class.cast(result).keySet().size() > 0);
+        assertTrue(result instanceof Document, "Result is not of type Document");
+        assertTrue(Document.class.cast(result).keySet().size() > 0, "The result should contain keys");
     }
 
     @Test
     public void testCommand() throws Exception {
         // Call hostInfo, command working with every configuration
         Object result = template.requestBody("direct:command", "{\"hostInfo\":\"1\"}");
-        assertTrue("Result is not of type Document", result instanceof Document);
-        assertTrue("The result should contain keys", Document.class.cast(result).keySet().size() > 0);
+        assertTrue(result instanceof Document, "Result is not of type Document");
+        assertTrue(Document.class.cast(result).keySet().size() > 0, "The result should contain keys");
     }
 
     @Test
     public void testOperationHeader() throws Exception {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
 
         // check that the count operation was invoked instead of the insert
         // operation
         Object result = template.requestBodyAndHeader("direct:insert", "irrelevantBody", MongoDbConstants.OPERATION_HEADER, "count");
-        assertTrue("Result is not of type Long", result instanceof Long);
-        assertEquals("Test collection should not contain any records", 0L, result);
+        assertTrue(result instanceof Long, "Result is not of type Long");
+        assertEquals(0L, result, "Test collection should not contain any records");
 
         // check that the count operation was invoked instead of the insert
         // operation
         result = template.requestBodyAndHeader("direct:insert", "irrelevantBody", MongoDbConstants.OPERATION_HEADER, MongoDbOperation.count);
-        assertTrue("Result is not of type Long", result instanceof Long);
-        assertEquals("Test collection should not contain any records", 0L, result);
+        assertTrue(result instanceof Long, "Result is not of type Long");
+        assertEquals(0L, result, "Test collection should not contain any records");
 
     }
 
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java
index 7f0b665..3eb088f 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOutputTypeTest.java
@@ -25,16 +25,21 @@ import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.commons.lang3.ObjectUtils;
 import org.bson.Document;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.apache.camel.component.mongodb.MongoDbConstants.MONGO_ID;
+import static org.apache.camel.test.junit5.TestSupport.assertListSize;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class MongoDbOutputTypeTest extends AbstractMongoDbTest {
 
     @Test
     public void testFindAllDBCursor() {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
         // Repeat ten times, obtain 10 batches of 100 results each time
         int numToSkip = 0;
@@ -44,15 +49,15 @@ public class MongoDbOutputTypeTest extends AbstractMongoDbTest {
             headers.put(MongoDbConstants.NUM_TO_SKIP, numToSkip);
             headers.put(MongoDbConstants.LIMIT, 100);
             Object result = template.requestBodyAndHeaders("direct:findAllDBCursor", ObjectUtils.NULL, headers);
-            assertTrue("Result is not of type MongoIterable", result instanceof MongoIterable);
+            assertTrue(result instanceof MongoIterable, "Result is not of type MongoIterable");
 
             @SuppressWarnings("unchecked")
             MongoIterable<Document> resultCursor = (MongoIterable<Document>)result;
             // Ensure that all returned documents contain all fields
             for (Document document : resultCursor) {
-                assertNotNull("Document in returned list should contain all fields", document.get(MONGO_ID));
-                assertNotNull("Document in returned list should contain all fields", document.get("scientist"));
-                assertNotNull("Document in returned list should contain all fields", document.get("fixedField"));
+                assertNotNull(document.get(MONGO_ID), "Document in returned list should contain all fields");
+                assertNotNull(document.get("scientist"), "Document in returned list should contain all fields");
+                assertNotNull(document.get("fixedField"), "Document in returned list should contain all fields");
             }
 
             numToSkip = numToSkip + limit;
@@ -62,10 +67,10 @@ public class MongoDbOutputTypeTest extends AbstractMongoDbTest {
     @Test
     public void testFindAllDocumentList() {
         // Test that the collection has 0 documents in it
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         pumpDataIntoTestCollection();
         Object result = template.requestBody("direct:findAllDocumentList", ObjectUtils.NULL);
-        assertTrue("Result is not of type List", result instanceof List);
+        assertTrue(result instanceof List, "Result is not of type List");
         @SuppressWarnings("unchecked")
         List<Document> resultList = (List<Document>)result;
 
@@ -73,13 +78,13 @@ public class MongoDbOutputTypeTest extends AbstractMongoDbTest {
 
         // Ensure that all returned documents contain all fields
         for (Document document : resultList) {
-            assertNotNull("Document in returned list should contain all fields", document.get(MONGO_ID));
-            assertNotNull("Document in returned list should contain all fields", document.get("scientist"));
-            assertNotNull("Document in returned list should contain all fields", document.get("fixedField"));
+            assertNotNull(document.get(MONGO_ID), "Document in returned list should contain all fields");
+            assertNotNull(document.get("scientist"), "Document in returned list should contain all fields");
+            assertNotNull(document.get("fixedField"), "Document in returned list should contain all fields");
         }
 
         for (Exchange resultExchange : getMockEndpoint("mock:resultFindAll").getReceivedExchanges()) {
-            assertEquals("Result total size header should equal 1000", 1000, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_TOTAL_SIZE));
+            assertEquals(1000, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_TOTAL_SIZE), "Result total size header should equal 1000");
         }
     }
 
@@ -96,7 +101,7 @@ public class MongoDbOutputTypeTest extends AbstractMongoDbTest {
             template.getCamelContext().addRoutes(taillableRouteBuilder);
             fail("Endpoint should not be initialized with a non compatible outputType");
         } catch (Exception exception) {
-            assertTrue("Exception is not of type IllegalArgumentException", exception.getCause() instanceof IllegalArgumentException);
+            assertTrue(exception.getCause() instanceof IllegalArgumentException, "Exception is not of type IllegalArgumentException");
         }
     }
 
@@ -113,7 +118,7 @@ public class MongoDbOutputTypeTest extends AbstractMongoDbTest {
             template.getCamelContext().addRoutes(taillableRouteBuilder);
             fail("Endpoint should not be initialized with a non compatible outputType");
         } catch (Exception exception) {
-            assertTrue("Exception is not of type IllegalArgumentException", exception.getCause() instanceof IllegalArgumentException);
+            assertTrue(exception.getCause() instanceof IllegalArgumentException, "Exception is not of type IllegalArgumentException");
         }
     }
 
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbReadPreferenceOptionTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbReadPreferenceOptionTest.java
index bfed84e..03b56a1 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbReadPreferenceOptionTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbReadPreferenceOptionTest.java
@@ -19,7 +19,11 @@ package org.apache.camel.component.mongodb;
 import com.mongodb.ReadPreference;
 import org.apache.camel.Endpoint;
 import org.apache.camel.ResolveEndpointFailedException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class MongoDbReadPreferenceOptionTest extends AbstractMongoDbTest {
 
@@ -31,7 +35,7 @@ public class MongoDbReadPreferenceOptionTest extends AbstractMongoDbTest {
             createMongoDbEndpoint("mongodb:myDb?database={{mongodb.testDb}}&readPreference=foo");
             fail("Should have thrown exception");
         } catch (ResolveEndpointFailedException refe) {
-            assertTrue(refe.getMessage(), refe.getMessage().endsWith("Unknown parameters=[{readPreference=foo}]"));
+            assertTrue(refe.getMessage().endsWith("Unknown parameters=[{readPreference=foo}]"), refe.getMessage());
         }
     }
 
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbStopEndpointTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbStopEndpointTest.java
index e915b47..81b14b4 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbStopEndpointTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbStopEndpointTest.java
@@ -19,9 +19,10 @@ package org.apache.camel.component.mongodb;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.builder.RouteBuilder;
 import org.bson.Document;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.apache.camel.component.mongodb.MongoDbConstants.MONGO_ID;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class MongoDbStopEndpointTest extends AbstractMongoDbTest {
 
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumerTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumerTest.java
index 02af695..f6c09ef 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumerTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumerTest.java
@@ -24,8 +24,10 @@ import org.apache.camel.ServiceStatus;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.bson.Document;
-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 com.mongodb.client.model.Filters.eq;
 
 public class MongoDbTailableCursorConsumerTest extends AbstractMongoDbTest {
@@ -45,7 +47,7 @@ public class MongoDbTailableCursorConsumerTest extends AbstractMongoDbTest {
 
     @Test
     public void testNoRecords() throws Exception {
-        assertEquals(0, cappedTestCollection.count());
+        assertEquals(0, cappedTestCollection.countDocuments());
         MockEndpoint mock = getMockEndpoint("mock:test");
         mock.expectedMessageCount(0);
         // DocumentBuilder.start().add("capped", true).add("size",
@@ -54,7 +56,7 @@ public class MongoDbTailableCursorConsumerTest extends AbstractMongoDbTest {
         CreateCollectionOptions collectionOptions = new CreateCollectionOptions().capped(true).sizeInBytes(1000000000).maxDocuments(1000);
         db.createCollection(cappedTestCollectionName, collectionOptions);
         cappedTestCollection = db.getCollection(cappedTestCollectionName, Document.class);
-        assertEquals(0, cappedTestCollection.count());
+        assertEquals(0, cappedTestCollection.countDocuments());
 
         addTestRoutes();
         context.getRouteController().startRoute("tailableCursorConsumer1");
@@ -66,7 +68,7 @@ public class MongoDbTailableCursorConsumerTest extends AbstractMongoDbTest {
 
     @Test
     public void testMultipleBursts() throws Exception {
-        assertEquals(0, cappedTestCollection.count());
+        assertEquals(0, cappedTestCollection.countDocuments());
         MockEndpoint mock = getMockEndpoint("mock:test");
         mock.expectedMessageCount(5000);
         // DocumentBuilder.start().add("capped", true).add("size",
@@ -109,7 +111,7 @@ public class MongoDbTailableCursorConsumerTest extends AbstractMongoDbTest {
 
     @Test
     public void testHundredThousandRecords() throws Exception {
-        assertEquals(0, cappedTestCollection.count());
+        assertEquals(0, cappedTestCollection.countDocuments());
         final MockEndpoint mock = getMockEndpoint("mock:test");
         mock.expectedMessageCount(1000);
 
@@ -153,7 +155,7 @@ public class MongoDbTailableCursorConsumerTest extends AbstractMongoDbTest {
 
     @Test
     public void testPersistentTailTrack() throws Exception {
-        assertEquals(0, cappedTestCollection.count());
+        assertEquals(0, cappedTestCollection.countDocuments());
         final MockEndpoint mock = getMockEndpoint("mock:test");
 
         // drop the tracking collection
@@ -226,7 +228,7 @@ public class MongoDbTailableCursorConsumerTest extends AbstractMongoDbTest {
 
     @Test
     public void testPersistentTailTrackIncreasingDateField() throws Exception {
-        assertEquals(0, cappedTestCollection.count());
+        assertEquals(0, cappedTestCollection.countDocuments());
         final MockEndpoint mock = getMockEndpoint("mock:test");
         final Calendar startTimestamp = Calendar.getInstance();
 
@@ -302,7 +304,7 @@ public class MongoDbTailableCursorConsumerTest extends AbstractMongoDbTest {
 
     @Test
     public void testCustomTailTrackLocation() throws Exception {
-        assertEquals(0, cappedTestCollection.count());
+        assertEquals(0, cappedTestCollection.countDocuments());
         final MockEndpoint mock = getMockEndpoint("mock:test");
 
         // get the custom tracking collection and drop it
@@ -378,7 +380,7 @@ public class MongoDbTailableCursorConsumerTest extends AbstractMongoDbTest {
     }
 
     private void testThousandRecordsWithRouteId(String routeId) throws Exception {
-        assertEquals(0, cappedTestCollection.count());
+        assertEquals(0, cappedTestCollection.countDocuments());
         MockEndpoint mock = getMockEndpoint("mock:test");
         mock.expectedMessageCount(1000);
 
@@ -390,7 +392,7 @@ public class MongoDbTailableCursorConsumerTest extends AbstractMongoDbTest {
         for (int i = 0; i < 1000; i++) {
             cappedTestCollection.insertOne(new Document("increasing", i).append("string", "value" + i));
         }
-        assertEquals(1000, cappedTestCollection.count());
+        assertEquals(1000, cappedTestCollection.countDocuments());
 
         addTestRoutes();
         context.getRouteController().startRoute(routeId);
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/meta/MongoDbMetaExtensionTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/meta/MongoDbMetaExtensionTest.java
index 51ee8a5..788a78f 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/meta/MongoDbMetaExtensionTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/meta/MongoDbMetaExtensionTest.java
@@ -27,17 +27,17 @@ import org.apache.camel.component.extension.MetaDataExtension;
 import org.apache.camel.component.mongodb.AbstractMongoDbTest;
 import org.apache.camel.component.mongodb.MongoDbComponent;
 import org.bson.Document;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class MongoDbMetaExtensionTest extends AbstractMongoDbTest {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(MongoDbMetaExtensionTest.class);
+public class MongoDbMetaExtensionTest extends AbstractMongoDbTest {
 
     // We simulate the presence of an authenticated user
-    @Before
+    @BeforeEach
     public void createAuthorizationUser() {
         super.createAuthorizationUser();
     }
@@ -103,7 +103,7 @@ public class MongoDbMetaExtensionTest extends AbstractMongoDbTest {
         assertNotNull(result.getPayload(JsonNode.class).get("type"));
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testMissingCollection() throws Exception {
         // When
         final String database = "test";
@@ -118,20 +118,26 @@ public class MongoDbMetaExtensionTest extends AbstractMongoDbTest {
         parameters.put("password", PASSWORD);
 
         // Then
-        MetaDataExtension.MetaData result = component.getExtension(MetaDataExtension.class).get().meta(parameters).orElseThrow(IllegalArgumentException::new);
+        assertThrows(IllegalArgumentException.class, () -> {
+
+            component.getExtension(MetaDataExtension.class).get().meta(parameters).orElseThrow(IllegalArgumentException::new);
+        });
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testMissingParameters() throws Exception {
         // When
         MongoDbComponent component = this.getComponent();
         // Given
         Map<String, Object> parameters = new HashMap<>();
+
         // Then
-        MetaDataExtension.MetaData result = component.getExtension(MetaDataExtension.class).get().meta(parameters).orElseThrow(IllegalArgumentException::new);
+        assertThrows(IllegalArgumentException.class, () -> {
+            component.getExtension(MetaDataExtension.class).get().meta(parameters).orElseThrow(IllegalArgumentException::new);
+        });
     }
 
-    @Test(expected = UnsupportedOperationException.class)
+    @Test
     public void testNotValidatedCollection() throws Exception {
         // When
         final String database = "test";
@@ -147,7 +153,9 @@ public class MongoDbMetaExtensionTest extends AbstractMongoDbTest {
         parameters.put("password", PASSWORD);
 
         // Then
-        MetaDataExtension.MetaData result = component.getExtension(MetaDataExtension.class).get().meta(parameters).orElseThrow(UnsupportedOperationException::new);
+        assertThrows(UnsupportedOperationException.class, () -> {
+            component.getExtension(MetaDataExtension.class).get().meta(parameters).orElseThrow(UnsupportedOperationException::new);
+        });
     }
 
 }
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/processor/idempotent/MongoDbIdempotentRepositoryTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/processor/idempotent/MongoDbIdempotentRepositoryTest.java
index 1c6bbc5..4a5cce7 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/processor/idempotent/MongoDbIdempotentRepositoryTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/processor/idempotent/MongoDbIdempotentRepositoryTest.java
@@ -20,16 +20,19 @@ import java.util.UUID;
 
 import org.apache.camel.component.mongodb.AbstractMongoDbTest;
 import org.bson.Document;
-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 static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class MongoDbIdempotentRepositoryTest extends AbstractMongoDbTest {
 
     MongoDbIdempotentRepository repo;
 
-    @Before
-    @After
+    @BeforeEach
+    @AfterEach
     public void clearDB() {
         testCollection.deleteMany(new Document());
     }
@@ -45,8 +48,8 @@ public class MongoDbIdempotentRepositoryTest extends AbstractMongoDbTest {
         String randomUUIDString = UUID.randomUUID().toString();
 
         boolean added = repo.add(randomUUIDString);
-        assertEquals("Driver inserted document", 1, testCollection.count());
-        assertTrue("Add ui returned true", added);
+        assertEquals(1, testCollection.countDocuments(), "Driver inserted document");
+        assertTrue(added, "Add ui returned true");
     }
 
     @Test
@@ -54,10 +57,10 @@ public class MongoDbIdempotentRepositoryTest extends AbstractMongoDbTest {
         String randomUUIDString = UUID.randomUUID().toString();
 
         repo.add(randomUUIDString);
-        assertEquals(1, testCollection.count());
+        assertEquals(1, testCollection.countDocuments());
 
         boolean found = repo.contains(randomUUIDString);
-        assertTrue("Added uid was found", found);
+        assertTrue(found, "Added uid was found");
     }
 
     @Test
@@ -65,11 +68,11 @@ public class MongoDbIdempotentRepositoryTest extends AbstractMongoDbTest {
         String randomUUIDString = UUID.randomUUID().toString();
 
         repo.add(randomUUIDString);
-        assertEquals(1, testCollection.count());
+        assertEquals(1, testCollection.countDocuments());
 
         boolean removed = repo.remove(randomUUIDString);
-        assertTrue("Added uid was removed correctly", removed);
-        assertEquals(0, testCollection.count());
+        assertTrue(removed, "Added uid was removed correctly");
+        assertEquals(0, testCollection.countDocuments());
     }
 
     @Test
@@ -77,36 +80,36 @@ public class MongoDbIdempotentRepositoryTest extends AbstractMongoDbTest {
         String randomUUIDString = UUID.randomUUID().toString();
 
         repo.add(randomUUIDString);
-        assertEquals(1, testCollection.count());
+        assertEquals(1, testCollection.countDocuments());
 
         boolean added = repo.add(randomUUIDString);
-        assertTrue("Duplicated entry was not added", !added);
-        assertEquals(1, testCollection.count());
+        assertTrue(!added, "Duplicated entry was not added");
+        assertEquals(1, testCollection.countDocuments());
     }
 
     @Test
     public void deleteMissingiIsFailse() throws Exception {
         String randomUUIDString = UUID.randomUUID().toString();
-        assertEquals(0, testCollection.count());
+        assertEquals(0, testCollection.countDocuments());
         boolean removed = repo.remove(randomUUIDString);
-        assertTrue("Non exisint uid returns false", !removed);
+        assertTrue(!removed, "Non exisint uid returns false");
     }
 
     @Test
     public void containsMissingReturnsFalse() throws Exception {
         String randomUUIDString = UUID.randomUUID().toString();
         boolean found = repo.contains(randomUUIDString);
-        assertTrue("Non existing item is not found", !found);
+        assertTrue(!found, "Non existing item is not found");
     }
 
     @Test
     public void confirmAllwaysReturnsTrue() throws Exception {
         String randomUUIDString = UUID.randomUUID().toString();
         boolean found = repo.confirm(randomUUIDString);
-        assertTrue("Confirm always returns true", found);
+        assertTrue(found, "Confirm always returns true");
 
         found = repo.confirm(null);
-        assertTrue("Confirm always returns true, even with null", found);
+        assertTrue(found, "Confirm always returns true, even with null");
     }
 
 }
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/verifier/MongoDbVerifierExtensionTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/verifier/MongoDbVerifierExtensionTest.java
index 010bc98..ac239ce 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/verifier/MongoDbVerifierExtensionTest.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/verifier/MongoDbVerifierExtensionTest.java
@@ -23,17 +23,16 @@ import org.apache.camel.Component;
 import org.apache.camel.component.extension.ComponentVerifierExtension;
 import org.apache.camel.component.mongodb.AbstractMongoDbTest;
 import org.apache.camel.component.mongodb.MongoDbComponent;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class MongoDbVerifierExtensionTest extends AbstractMongoDbTest {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(MongoDbVerifierExtensionTest.class);
+public class MongoDbVerifierExtensionTest extends AbstractMongoDbTest {
 
     // We simulate the presence of an authenticated user
-    @Before
+    @BeforeEach
     public void createAuthorizationUser() {
         super.createAuthorizationUser();
     }