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 2020/06/11 16:55:54 UTC

[camel] branch master updated: CAMEL-11807: Migrated camel-typeconverterscan-test/camel-partial-classpath-test to JUnit 5

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


The following commit(s) were added to refs/heads/master by this push:
     new 98c43c4  CAMEL-11807: Migrated camel-typeconverterscan-test/camel-partial-classpath-test to JUnit 5
98c43c4 is described below

commit 98c43c4be79fe80d540cbcb5fac517727baa0e55
Author: aldettinger <al...@gmail.com>
AuthorDate: Thu Jun 11 18:54:09 2020 +0200

    CAMEL-11807: Migrated camel-typeconverterscan-test/camel-partial-classpath-test to JUnit 5
---
 tests/camel-partial-classpath-test/pom.xml         |  7 +---
 .../camel/tests/partialclasspath/RouteTest.java    |  6 +--
 tests/camel-typeconverterscan-test/pom.xml         |  7 +---
 .../tests/typeconverterscan/RouteMainTest.java     | 47 +++++++++++-----------
 .../camel/tests/typeconverterscan/RouteTest.java   |  6 +--
 5 files changed, 32 insertions(+), 41 deletions(-)

diff --git a/tests/camel-partial-classpath-test/pom.xml b/tests/camel-partial-classpath-test/pom.xml
index 709b8f2..86f4e2b 100644
--- a/tests/camel-partial-classpath-test/pom.xml
+++ b/tests/camel-partial-classpath-test/pom.xml
@@ -55,12 +55,7 @@
         <!-- testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
+            <artifactId>camel-test-junit5</artifactId>
             <scope>test</scope>
         </dependency>
 
diff --git a/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/RouteTest.java b/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/RouteTest.java
index 87e385b..cd6c00d 100644
--- a/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/RouteTest.java
+++ b/tests/camel-partial-classpath-test/src/test/java/org/apache/camel/tests/partialclasspath/RouteTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.tests.partialclasspath;
 import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-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 RouteTest extends CamelTestSupport {
 
@@ -33,7 +33,7 @@ public class RouteTest extends CamelTestSupport {
     }
 
     @Test
-    public void testRoute() throws Exception {
+    void testRoute() throws Exception {
         MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
         resultEndpoint.expectedBodiesReceived(new MyBean("foo", "bar"));
 
diff --git a/tests/camel-typeconverterscan-test/pom.xml b/tests/camel-typeconverterscan-test/pom.xml
index f2e5b91..a2a4544 100644
--- a/tests/camel-typeconverterscan-test/pom.xml
+++ b/tests/camel-typeconverterscan-test/pom.xml
@@ -41,12 +41,7 @@
         <!-- testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
+            <artifactId>camel-test-junit5</artifactId>
             <scope>test</scope>
         </dependency>
 
diff --git a/tests/camel-typeconverterscan-test/src/test/java/org/apache/camel/tests/typeconverterscan/RouteMainTest.java b/tests/camel-typeconverterscan-test/src/test/java/org/apache/camel/tests/typeconverterscan/RouteMainTest.java
index 5ca2b00..6a98f5d 100644
--- a/tests/camel-typeconverterscan-test/src/test/java/org/apache/camel/tests/typeconverterscan/RouteMainTest.java
+++ b/tests/camel-typeconverterscan-test/src/test/java/org/apache/camel/tests/typeconverterscan/RouteMainTest.java
@@ -19,32 +19,33 @@ package org.apache.camel.tests.typeconverterscan;
 import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.junit.Assert;
-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;
 
 public class RouteMainTest {
 
     @Test
-    public void testLoadTypeConverter() throws Exception {
-        CamelContext context = new DefaultCamelContext();
-        context.setLoadTypeConverters(true);
-
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").convertBodyTo(MyBean.class);
-            }
-        });
-
-        context.start();
-
-        Object out = context.createProducerTemplate().requestBody("direct:start", "foo:bar");
-        Assert.assertNotNull(out);
-
-        MyBean my = (MyBean) out;
-        Assert.assertEquals("foo", my.getA());
-        Assert.assertEquals("bar", my.getB());
-
-        context.stop();
+    void testLoadTypeConverter() throws Exception {
+        try (CamelContext context = new DefaultCamelContext()) {
+            context.setLoadTypeConverters(true);
+
+            context.addRoutes(new RouteBuilder() {
+                @Override
+                public void configure() {
+                    from("direct:start").convertBodyTo(MyBean.class);
+                }
+            });
+
+            context.start();
+
+            Object out = context.createProducerTemplate().requestBody("direct:start", "foo:bar");
+            assertNotNull(out);
+
+            MyBean my = (MyBean)out;
+            assertEquals("foo", my.getA());
+            assertEquals("bar", my.getB());
+        }
     }
 }
diff --git a/tests/camel-typeconverterscan-test/src/test/java/org/apache/camel/tests/typeconverterscan/RouteTest.java b/tests/camel-typeconverterscan-test/src/test/java/org/apache/camel/tests/typeconverterscan/RouteTest.java
index 02ea387..4410da6 100644
--- a/tests/camel-typeconverterscan-test/src/test/java/org/apache/camel/tests/typeconverterscan/RouteTest.java
+++ b/tests/camel-typeconverterscan-test/src/test/java/org/apache/camel/tests/typeconverterscan/RouteTest.java
@@ -19,8 +19,8 @@ package org.apache.camel.tests.typeconverterscan;
 import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-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 RouteTest extends CamelTestSupport {
 
@@ -33,7 +33,7 @@ public class RouteTest extends CamelTestSupport {
     }
 
     @Test
-    public void testRoute() throws Exception {
+    void testRoute() throws Exception {
         MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
         resultEndpoint.expectedBodiesReceived(new MyBean("foo", "bar"));