Hi Excellent. Seems to fix all of our problems. Good work
Claus Ibsen-2 wrote: > > Hi > > Can you try latest code as we have committed a fix after the 2.3 release. > > > On Thu, May 27, 2010 at 2:51 PM, eirilwan <[email protected]> wrote: >> >> Hi >> >> When upgrading from Camel 2.1.0 to 2.3.0 we encountered a problem using >> Mockito to mock endpoint behaviour while testing camel routes. >> >> Our test is running with junit4 using Spring context configuration. We >> inject mockito mocked endpoints into both the test and the route like >> this: >> >> �...@produce(uri = "mock:successConsumer") >> protected MockEndpoint successConsumer; >> >> �...@resource(name = "testRepo") >> protected TestRepository someRepo; >> >> The TestRepo is created in spring using XML configuration: >> <bean id="someRepo" class="org.mockito.Mockito" factory-method="mock"> >> <constructor-arg value="xxx.xxx.TestRepository"/> >> </bean> >> >> >> The code we try to test is: >> from("direct:calveConsumer") >> .bean(someRepo, "someRepoMethod").to(successConsumer) >> >> >> When running the test, camel don't seem to find the someRepoMethod on the >> "someRepo" bean. We have tracked down the problem to getTargetClass in >> org.apache.camel.component.bean.BeanInfo.class. >> >> Since mockito is using cglib for enhancing interfaces, this method return >> the superclass of the mock, which is Object. This behaviour will work >> fine >> when an object is enhanced with cglib, but not when you use cglib to >> enhance >> an interface. >> >> An solution could be to check if the class before $$ is an interface and >> return it if it is. >> >> Any thoughts? >> >> Our solution right now is to create real mock stubs of all interfaces to >> work around the problem. >> >> regards >> Eirik L. Wang >> >> -- >> View this message in context: >> http://old.nabble.com/Using-mockito-to-mock-endpoint-behavior-tp28693620p28693620.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > > -- View this message in context: http://old.nabble.com/Using-mockito-to-mock-endpoint-behavior-tp28693620p28727536.html Sent from the Camel - Users mailing list archive at Nabble.com.
