I'm trying to write unit test with JUnit 5 and Camel support.
@Test
@ParameterizedTest(name = "Test case [{index}] name={3}")
@MethodSource("data")
@IfEnvProfile(profiles = {"preprod"}) (Customized Annotation)
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);
}
where location.enricher.uri
- http://localhost/rating-service/api/v1/rate/d155446421121/location/ (is up and running).
but when I run it, I'm always receiving Nullpointer
exception on response.
Doubts:
Is it possible to combine JUnit 5 in class A and JUnit 4 in CamelSupport
which extends Class A?
Do we have CamelTestSupportClass
for JUnit 5?
Could anyone help?
Thanks, Rajesh S
Currently Camel supports Junit 5. You just have to include this in your pom.xml
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-junit5</artifactId>
</dependency>
And import the class:
import org.apache.camel.test.junit5.CamelTestSupport;
See here for more information.
org.apache.camel.test.junit4.CamelTestSupport
only works with JUnit 4.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With