Document MockEndpoint timed assertions in AGENTS.md - #24496
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
ℹ️ CI did not run targeted module tests. 🔬 Scalpel shadow comparison — Scalpel: 644 tested, 29 compile-only — current: 0 all testedMaveniverse Scalpel detected 673 affected modules (current approach: 0).
|
…or mock-based waits Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
aa020d1 to
fcdf556
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…aitility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
oscerd
left a comment
There was a problem hiding this comment.
LGTM. I verified the documented MockEndpoint guidance against components/camel-mock/.../MockEndpoint.java:
- The timed static overload
assertIsSatisfied(context, 10, TimeUnit.SECONDS)exists and simply setsresultWaitTimethen calls the no-arg assert. - The "already waits ~10s internally" note is accurate:
resultWaitTimedefaults to 0 andwaitForCompleteLatch(0)falls back to a 10s wait, so the timed overload is only needed for a different timeout. - The latch /
CountDownLatchcharacterization and thegetReceivedCounter()-based Awaitility example for mid-test synchronization are correct.
Since CLAUDE.md is a symlink to AGENTS.md, the single edit covers both. Already approved by two committers; adding mine.
Reviewed with Claude Code on behalf of Andrea Cosentino. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.
Summary
Claude Code on behalf of Guillaume Nodet
MockEndpoint'sbuilt-in timed assertions (
assertIsSatisfied(context, timeout, unit)) over wrapping withAwaitility when the wait condition is "mock expectations are met"
MockEndpoint cannot express, e.g.
mock.getReceivedCounter() >= N)This came up during review of #24304, where
Thread.sleep()was being replaced withawait().untilAsserted(() -> MockEndpoint.assertIsSatisfied(...))— which is redundant becauseMockEndpoint's assertion is already latch-based internally.
Test plan
🤖 Generated with Claude Code