我的骆驼路线如下
public class IncomingBatchFileRoute extends RouteBuilder {
@Value(CCS_PROCESSING_INCOMING_DIRECTORY)
private String source;
@Override
public void configure() throws Exception {
from(sourceLocation)).autoStartup(false).to("encryptionEndPoint");
}
}
我需要为上述骆驼路线写一个JUNIT,这是我的新手,并创建了如下结构
public class IncomingBatchFileRouteTest extends CamelTestSupport{
@Override
public RoutesBuilder createRouteBuilder() throws Exception {
return new IncomingBatchFileRoute();
}
@Test
public void sampleMockTest() {
}
}
不确定如何完成它。请您为此提供帮助
答案 0 :(得分:0)
您需要模拟您的加密端点,并使用生产者模板开始路由
@Produce(uri = CCS_PROCESSING_INCOMING_DIRECTORY)
protected ProducerTemplate template;
@EndpointInject(uri = "encryptionEndPoint")
protected MockEndpoint resultEndpoint;
@Test
public void sampleMockTest() {
// GIVEN
this.resultEndpoint.expectedMessageCount(1);
// WHEN
this.template.sendBody("Hey");
// THEN
this.resultEndpoint.assertIsSatisfied();
}