如何在骆驼单元测试中模拟多个组件? [英] How to mock multiple components in camel unit test?

查看:31
本文介绍了如何在骆驼单元测试中模拟多个组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在骆驼版本 2.13.1 中使用 CamelTestSupport.

I'm using the CamelTestSupport in camel version 2.13.1.

我想做这样的事情来模拟两个不同的组件:

I'd like to do something like this to mock out two different components:

@Override
public String isMockEndpoints() {
    return "(activemq|exec)*";
}

我不能只用*"来模拟所有内容,因为我从我正在使用的 activiti 框架中得到了错误,该框架依赖于 activiti 组件.

I can't just mock everything with "*" because I was getting errors from the activiti framework I'm using, which relies on the activiti component.

你们有没有找到一种方法来做这样的事情?

Have any of you found a way to do something like this?

推荐答案

您可以使用正则表达式,因此类似于:

You can use regular expression, so its something a like:

 return "(activemq.*|exec.*)" 

见本页底部http://camel.apache.org/intercept

这篇关于如何在骆驼单元测试中模拟多个组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆