断言错误骆驼测试
AssertionError Camel-Test
我是测试 Camel Routes 的新手,遇到了一些问题。
我在定义路线的地方有以下代码
from("jms:preview")
.to("jms:preview-request")
我想测试这条路线,所以我尝试了以下测试代码
public class RouteTest extends CamelTestSupport {
protected RouteBuilder createRoutesBuilder() throws Exception {
return new MyRouteBuilder();
}
@Test
public void testRoute() throws Exception{
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost:61616");
context.addComponent("jms",JmsComponent.jmsComponent(connectionFactory));
MockEndpoint mock = getMockEndpoint("mock:jms:preview");
mock.expectedBodiesReceived("request");
template.sendBodyAndHeader("jms:preview-request,"request","request_type","rss");
assertMockEndpointsSatisfied();
}
我收到以下错误
Received message count. Expected: <1> but was: <0>
。
我已经阅读了其他示例,但我不明白我错在哪里。
谁能帮帮我?
看来你把它发送到了错误的端点,如果你有
from("jms:preview")
在你的路线中,那么你可能应该像
template.sendBodyAndHeader("jms:preview,"request","request_type","rss");
我是测试 Camel Routes 的新手,遇到了一些问题。 我在定义路线的地方有以下代码
from("jms:preview")
.to("jms:preview-request")
我想测试这条路线,所以我尝试了以下测试代码
public class RouteTest extends CamelTestSupport {
protected RouteBuilder createRoutesBuilder() throws Exception {
return new MyRouteBuilder();
}
@Test
public void testRoute() throws Exception{
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost:61616");
context.addComponent("jms",JmsComponent.jmsComponent(connectionFactory));
MockEndpoint mock = getMockEndpoint("mock:jms:preview");
mock.expectedBodiesReceived("request");
template.sendBodyAndHeader("jms:preview-request,"request","request_type","rss");
assertMockEndpointsSatisfied();
}
我收到以下错误
Received message count. Expected: <1> but was: <0>
。
我已经阅读了其他示例,但我不明白我错在哪里。
谁能帮帮我?
看来你把它发送到了错误的端点,如果你有
from("jms:preview")
在你的路线中,那么你可能应该像
template.sendBodyAndHeader("jms:preview,"request","request_type","rss");