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

[camel] branch master updated: CAMEL-15165: Added unit test

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

davsclaus 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 cefb0bd  CAMEL-15165: Added unit test
cefb0bd is described below

commit cefb0bd9b7f081635ab971feb586e86d2bd733bf
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Jun 10 09:50:38 2020 +0200

    CAMEL-15165: Added unit test
---
 .../tests/typeconverterscan/RouteMainTest.java     | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

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
new file mode 100644
index 0000000..1a920a6
--- /dev/null
+++ b/tests/camel-typeconverterscan-test/src/test/java/org/apache/camel/tests/typeconverterscan/RouteMainTest.java
@@ -0,0 +1,34 @@
+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;
+
+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();
+    }
+}