Raj*_*esh 2 spring-boot junit5
我正在尝试使用JUnit 5和Camel支持编写单元测试。
@Test
@ParameterizedTest(name = "Test case [{index}] name={3}")
@MethodSource("data")
@IfEnvProfile(profiles = {"preprod"}) (Customized Annotation)
Run Code Online (Sandbox Code Playgroud)
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);
}
Run Code Online (Sandbox Code Playgroud)
其中location.enricher.uri- HTTP://本地主机/评级服务/ API / V1 /速度/ d155446421121 /位置/(启动和运行)。
但是当我运行它时,我总是会Nullpointer在响应时收到异常。
疑问:
是否可以将A类中的JUnit 5和CamelSupport扩展了A 类的JUnit 4组合在一起?
我们有CamelTestSupportClassJUnit 5吗?
有人可以帮忙吗?
谢谢,Rajesh S
目前 Camel 支持 Junit 5。您只需将其包含在 pom.xml 中
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-junit5</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
并导入类:
import org.apache.camel.test.junit5.CamelTestSupport;
Run Code Online (Sandbox Code Playgroud)
浏览此处获取更多信息。
| 归档时间: |
|
| 查看次数: |
1173 次 |
| 最近记录: |