This is an automated email from the ASF dual-hosted git repository.

gnodet 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 c0b2b030a229 chore: add AssertJ assertion rule to AGENTS.md (#24956)
c0b2b030a229 is described below

commit c0b2b030a229d3853ad3203004317b46fe6b7996
Author: Guillaume Nodet <[email protected]>
AuthorDate: Mon Jul 20 19:12:00 2026 +0200

    chore: add AssertJ assertion rule to AGENTS.md (#24956)
---
 AGENTS.md | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/AGENTS.md b/AGENTS.md
index f2f62990d95c..0296a6ab61f2 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -156,6 +156,37 @@ When merging a PR, an agent MUST perform the following 
steps **in order**:
   - Avoid usage of deprecated code
 - Changes should aim to preserve or improve overall code quality.
 
+### Assertions: Use AssertJ When Possible
+
+Prefer [AssertJ](https://assertj.github.io/doc/) assertions over JUnit 
assertions in test code.
+AssertJ is already available as a test dependency in the project and provides 
more readable,
+fluent assertions with better failure messages.
+
+**Examples:**
+
+```java
+// Preferred — AssertJ:
+assertThat(result).isEqualTo("expected");
+assertThat(list).hasSize(3).contains("a", "b");
+assertThat(exception).isInstanceOf(IOException.class).hasMessageContaining("timeout");
+assertThat(exchange.getIn().getBody(String.class)).startsWith("Hello");
+
+// Avoid — JUnit:
+assertEquals("expected", result);
+assertEquals(3, list.size());
+assertTrue(list.contains("a"));
+```
+
+**Rules:**
+
+- New test code SHOULD use AssertJ assertions (`assertThat(...)`) instead of 
JUnit assertions
+  (`assertEquals`, `assertTrue`, `assertFalse`, `assertNotNull`, etc.).
+- When modifying existing test code that uses JUnit assertions, migrate 
touched assertions to
+  AssertJ where it improves readability. No need to migrate the entire file.
+- Do NOT mix AssertJ and JUnit assertions in the same test method — pick one 
style per method.
+- `MockEndpoint.assertIsSatisfied()` and other Camel-specific assertion 
methods are NOT JUnit
+  assertions — keep using them as-is.
+
 ### Asynchronous Testing: Use Awaitility Instead of Thread.sleep
 
 Do **NOT** use `Thread.sleep()` in test code. It leads to flaky, slow, and 
non-deterministic tests.

Reply via email to