camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-11178: Added a test to ensure that default methods are explicitly supported in bean binding
Date Fri, 02 Jun 2017 07:18:38 GMT
CAMEL-11178: Added a test to ensure that default methods are explicitly supported in bean binding


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/368559c2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/368559c2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/368559c2

Branch: refs/heads/master
Commit: 368559c2cdf38e0a5bfb93ea9158b00fa2ea1705
Parents: a6d7029
Author: aldettinger <aldettinger@gmail.com>
Authored: Thu Jun 1 16:38:55 2017 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Jun 2 09:17:14 2017 +0200

----------------------------------------------------------------------
 ...ultMethodCalledFromSimpleExpressionTest.java | 53 ++++++++++++++++++++
 1 file changed, 53 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/368559c2/camel-core/src/test/java/org/apache/camel/component/bean/issues/DefaultMethodCalledFromSimpleExpressionTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/issues/DefaultMethodCalledFromSimpleExpressionTest.java
b/camel-core/src/test/java/org/apache/camel/component/bean/issues/DefaultMethodCalledFromSimpleExpressionTest.java
new file mode 100644
index 0000000..2d24c56
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/issues/DefaultMethodCalledFromSimpleExpressionTest.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.bean.issues;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+public class DefaultMethodCalledFromSimpleExpressionTest extends ContextTestSupport {
+
+    private static final String DEFAULT_METHOD_CONTENT = "A.defaultMethod() has been called";
+
+    public void testDefaultMethodFromSimpleExpression() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived(DEFAULT_METHOD_CONTENT);
+
+        template.sendBodyAndProperty("direct:defaultMethod", "", "myObject", new B() {
+        });
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:defaultMethod").setBody(simple("${exchangeProperty.myObject.defaultMethod}")).to("mock:result");
+            }
+        };
+    }
+
+    public interface A {
+        default String defaultMethod() {
+            return DEFAULT_METHOD_CONTENT;
+        }
+    }
+
+    public interface B extends A {
+    }
+}


Mime
View raw message