You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2026/07/05 21:04:17 UTC
(camel) branch camel-23907-fix-flaky-test-threadsrejectedexecuti updated: CAMEL-23907: Address review - capture counters in local variables
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch camel-23907-fix-flaky-test-threadsrejectedexecuti
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-23907-fix-flaky-test-threadsrejectedexecuti by this push:
new df51fd32731f CAMEL-23907: Address review - capture counters in local variables
df51fd32731f is described below
commit df51fd32731f7ce02280743ad63d79b44f3babab
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Sun Jul 5 21:04:06 2026 +0000
CAMEL-23907: Address review - capture counters in local variables
Capture getReceivedCounter() in local variables before assertions
to avoid duplicate calls and improve readability of failure messages.
Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
---
.../camel/processor/ThreadsRejectedExecutionTest.java | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/ThreadsRejectedExecutionTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/ThreadsRejectedExecutionTest.java
index 5d16573181ce..eb3a2f864d3d 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/ThreadsRejectedExecutionTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/ThreadsRejectedExecutionTest.java
@@ -130,10 +130,8 @@ public class ThreadsRejectedExecutionTest extends ContextTestSupport {
Awaitility.await().atMost(10, TimeUnit.SECONDS)
.untilAsserted(() -> assertEquals(0, context.getInflightRepository().size()));
- assertTrue(getMockEndpoint("mock:result").getReceivedCounter() >= 2,
- "Expected at least 2 messages at mock:result but got "
- + getMockEndpoint("mock:result")
- .getReceivedCounter());
+ int resultCount = getMockEndpoint("mock:result").getReceivedCounter();
+ assertTrue(resultCount >= 2, "Expected at least 2 messages at mock:result but got " + resultCount);
}
@Test
@@ -191,14 +189,12 @@ public class ThreadsRejectedExecutionTest extends ContextTestSupport {
.untilAsserted(() -> assertEquals(0, context.getInflightRepository().size()));
// at least 2 messages should have made it through the thread pool
- assertTrue(getMockEndpoint("mock:result").getReceivedCounter() >= 2,
- "Expected at least 2 messages at mock:result but got "
- + getMockEndpoint("mock:result")
- .getReceivedCounter());
+ int resultCount = getMockEndpoint("mock:result").getReceivedCounter();
+ assertTrue(resultCount >= 2, "Expected at least 2 messages at mock:result but got " + resultCount);
// there should be no error handling for aborted tasks (no redeliveries and no error handling)
- assertEquals(0, getMockEndpoint("mock:error").getReceivedCounter(),
- "Expected 0 messages at mock:error but got " + getMockEndpoint("mock:error").getReceivedCounter());
+ int errorCount = getMockEndpoint("mock:error").getReceivedCounter();
+ assertEquals(0, errorCount, "Expected 0 messages at mock:error but got " + errorCount);
}
}