Removing the subclass for CamelTestSupport and instead doing mockEndpoint = camelContext.getEndpoint("mock:queue.incoming");
fixes the issue. -----Original Message----- From: Davis Ford [mailto:df...@axeda.com] Sent: Friday, September 23, 2011 4:39 PM To: users@camel.apache.org Subject: RE: testing camel proxy with a mock camel endpoint? Let me try a different approach to this question. I'm now injecting a mock:url into the endpoints so this seems like it should work but it doesn't... <bean id="myBean" name="myBean" class="org.apache.camel.spring.remoting.CamelProxyFactoryBean"> <property name="serviceUrl" value="mock:queue.incoming" /> <property name="serviceInterface" value="com.example.MyBeanInterface" /> </bean> @ContextConfiguration(locations={"classpath:applicationContext.xml"}) @RunWith(SpringJUnit4ClassRunner.class) public class MyTest extends CamelTestSupport { @Resource(name="myBean") MyBeanInterface bean; MockEndpoint mockEndpoint; @Before public void setUp() throws Exception { super.setUp(); mockEndpoint = getMockEndpoint("mock:queue.incoming"); mockEndpoint.expectedMessageCount(1); } @Test public void test() throws Exception { String retval = bean.callSomeMethod(); mockEndpoint.assertIsSatisfied(); } } The test fails indicating that 1 message was expected but zero were received. I'm not 100% certain why that is -- perhaps it has to do with the test subclassing CamelTestSupport but using spring's JUnit 4 test runner, so maybe they are two different camel context's ? i.e. one loaded in spring, and the other instantiated by CamelTestSupport itself? Any ideas? -----Original Message----- From: Davis Ford [mailto:df...@axeda.com] Sent: Friday, September 23, 2011 3:20 PM To: users@camel.apache.org Subject: testing camel proxy with a mock camel endpoint?