public void testReferenceEndpointFromOtherCamelContext() throws Exception {
CamelContext context = applicationContext.getBean("camel2", CamelContext.class);
RouteContext routeContext = new DefaultRouteContext(context);
try {
routeContext.resolveEndpoint(null, "endpoint1");
fail("Should have thrown exception");
} catch (NoSuchEndpointException exception) {
assertTrue("Get a wrong exception message", exception.getMessage().contains("make sure the endpoint has the same camel context as the route does"));
}
}