【发布时间】:2018-06-25 20:25:46
【问题描述】:
我正在尝试使用 JUnit 5 和 Camel 支持编写单元测试。
- JUnit 5 (5.0.0) 在 A 类中使用以下注解 @ 方法级别:
@Test
@ParameterizedTest(name = "Test case [{index}] name={3}")
@MethodSource("data")
@IfEnvProfile(profiles = {"preprod"}) (Customized Annotation)
- A 类扩展了使用 Junit 4 的 CamelTestSupport。尝试使用以下代码访问服务:
protected ResponseDto getReponse(String testFile) throws Exception {
Transaction tx= new Transaction ();
final Map<String,Object> headers= setAllHeader(tx);
// enter code here
ResponseDto response =
(RatingResponseDto) template.sendBodyAndHeaders("{{.location.enricher.uri}}",
ExchangePattern.InOut, tx, headers);
}
location.enricher.uri - http://localhost/rating-service/api/v1/rate/d155446421121/location/(已启动并运行)。
但是当我运行它时,我总是收到Nullpointer 响应异常。
疑问:
是否可以将 A 类中的 JUnit 5 和扩展 A 类的
CamelSupport中的 JUnit 4 结合起来?我们有 JUnit 5 的
CamelTestSupportClass吗?
有人可以帮忙吗?
谢谢, 拉杰什S
【问题讨论】:
标签: spring-boot junit5