This is an automated email from the ASF dual-hosted git repository.
apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new a56c64118841 Improve test assertion in ValidatorRouteTest
a56c64118841 is described below
commit a56c641188417da705c5e01d8ac65c150e7edf40
Author: Aurélien Pupier <[email protected]>
AuthorDate: Mon May 18 14:12:36 2026 +0200
Improve test assertion in ValidatorRouteTest
use AssertJ to have more details in case of test failures
Signed-off-by: Aurélien Pupier <[email protected]>
---
components/camel-json-validator/pom.xml | 5 +++++
.../apache/camel/component/jsonvalidator/ValidatorRouteTest.java | 6 ++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/components/camel-json-validator/pom.xml
b/components/camel-json-validator/pom.xml
index 41c88b72645e..8d813b389a3d 100644
--- a/components/camel-json-validator/pom.xml
+++ b/components/camel-json-validator/pom.xml
@@ -57,6 +57,11 @@
<artifactId>camel-test-junit6</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
diff --git
a/components/camel-json-validator/src/test/java/org/apache/camel/component/jsonvalidator/ValidatorRouteTest.java
b/components/camel-json-validator/src/test/java/org/apache/camel/component/jsonvalidator/ValidatorRouteTest.java
index 80a86b28615b..62168e38fb04 100644
---
a/components/camel-json-validator/src/test/java/org/apache/camel/component/jsonvalidator/ValidatorRouteTest.java
+++
b/components/camel-json-validator/src/test/java/org/apache/camel/component/jsonvalidator/ValidatorRouteTest.java
@@ -25,6 +25,7 @@ import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit6.CamelTestSupport;
import org.junit.jupiter.api.Test;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class ValidatorRouteTest extends CamelTestSupport {
@@ -110,8 +111,9 @@ public class ValidatorRouteTest extends CamelTestSupport {
Exception exception = out.getException();
assertTrue(out.isFailed(), "Should be failed");
- assertTrue(exception instanceof NoJsonHeaderValidationException,
"Exception should be correct type");
- assertTrue(exception.getMessage().contains("headerToValidate"),
"Exception should mention missing header");
+ assertThat(exception)
+ .isInstanceOf(NoJsonHeaderValidationException.class)
+ .hasMessageContaining("headerToValidate");
}
@Test