CAMEL-8113: added unit test
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9cd39ab9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9cd39ab9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9cd39ab9 Branch: refs/heads/master Commit: 9cd39ab902309e630a41560cfe585deee2c99a2e Parents: aa2339d Author: Claus Ibsen <davscl...@apache.org> Authored: Thu Dec 18 15:47:01 2014 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu Dec 18 21:27:57 2014 +0100 ---------------------------------------------------------------------- .../processor/TransformMethodCallTest.java | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/9cd39ab9/camel-core/src/test/java/org/apache/camel/processor/TransformMethodCallTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/processor/TransformMethodCallTest.java b/camel-core/src/test/java/org/apache/camel/processor/TransformMethodCallTest.java new file mode 100644 index 0000000..6144e3c --- /dev/null +++ b/camel-core/src/test/java/org/apache/camel/processor/TransformMethodCallTest.java @@ -0,0 +1,48 @@ +/** + * 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.processor; + +import org.apache.camel.ContextTestSupport; +import org.apache.camel.builder.RouteBuilder; + +/** + * @version + */ +public class TransformMethodCallTest extends ContextTestSupport { + + public void testTransform() throws Exception { + getMockEndpoint("mock:result").expectedBodiesReceived("Hello World"); + + template.sendBody("direct:start", "World"); + + assertMockEndpointsSatisfied(); + } + + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + public void configure() { + from("direct:start") + .transform().method(TransformMethodCallTest.class, "transformMe") + .to("mock:result"); + } + }; + } + + public String transformMe(String in) { + return "Hello " + in; + } +}