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
commit af7884a4eb1039f3023f3f42998f69c997d80f3e Author: Aurélien Pupier <[email protected]> AuthorDate: Wed Jun 10 15:54:18 2026 +0200 CAMEL-23317 - RawMailMessagetest stabilization suspecting that the route can be started before the Mailbox is fully ready. Thus adding an await to ensure the mail arrived. Note that several other mail tests are using relatively similar strategy, even if it is when Camel is sending the mail and not created through the java API directly. Signed-off-by: Aurélien Pupier <[email protected]> --- .../java/org/apache/camel/component/mail/RawMailMessageTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/RawMailMessageTest.java b/components/camel-mail/src/test/java/org/apache/camel/component/mail/RawMailMessageTest.java index 2c6ba3870062..1135eeb8ccc2 100644 --- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/RawMailMessageTest.java +++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/RawMailMessageTest.java @@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.TimeUnit; import jakarta.mail.Folder; import jakarta.mail.Message; @@ -34,6 +35,7 @@ import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit6.CamelTestSupport; import org.junit.jupiter.api.Test; +import static org.awaitility.Awaitility.await; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -166,6 +168,11 @@ public class RawMailMessageTest extends CamelTestSupport { // insert one signed message folder.appendMessages(messages); folder.close(true); + + await() + .atMost(500, TimeUnit.MILLISECONDS) + .alias("Await that the sent mail is ready in the Mailbox before starting the Camel route") + .untilAsserted(() -> assertEquals(1, user.getInbox().getNewMessageCount())); } @Override
