davsclaus commented on code in PR #27785:
URL: https://github.com/apache/camel/pull/27785#discussion_r4266911178


##########
components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDisconnectTest.java:
##########
@@ -61,7 +61,7 @@ void setup() {
 
     @Test
     public void testDisconnect() throws Exception {
-        if (!latch.await(2500, TimeUnit.MILLISECONDS)) {
+        if (!latch.await(15, TimeUnit.SECONDS)) {

Review Comment:
   Not blocking: the latch counts the same exchanges that the mock counts, so 
it does not check the disconnect/reconnect any more than 
`mock.expectedMessageCount(5)` already does. CLAUDE.md prefers the timed mock 
assertion for this, e.g. `MockEndpoint.assertIsSatisfied(context, 15, 
TimeUnit.SECONDS);`, which would also let the `.process(e -> 
latch.countDown())` step go. Fine to keep the latch if you prefer its failure 
message.



##########
components/camel-mail/src/test/java/org/apache/camel/component/mail/MimeMultipartAlternativeWithLongerFilenameTest.java:
##########
@@ -62,15 +65,19 @@ private void sendMultipartEmail(boolean 
useInlineattachments) {
         in.addAttachment("cid:myCoolLogo.jpeg", new DataHandler(new 
FileDataSource("src/test/data/logo.jpeg")));
 
         // create a producer that can produce the exchange (= send the mail)
-        MockEndpoint mock = getMockEndpoint("mock:result");
+        MockEndpoint mock = getMockEndpoint(mockUri);
         mock.expectedMessageCount(1);
         mock.message(0).header(MailConstants.MAIL_ALTERNATIVE_BODY).isNull();
 
         context.createProducerTemplate().send(endpoint, exchange);
+
+        // a POP3 folder is a snapshot taken when it is opened 
(closeFolder=false keeps it open), so the
+        // consumer must only start polling once the mail is in the mailbox
+        context.getRouteController().startRoute(routeId);

Review Comment:
   Good, this is the actual fix: the POP3 folder is opened only after the mail 
has been delivered. Nit: `sendMultipartEmail` now also starts the consumer, so 
a name like `sendMultipartEmailAndStartConsumer` would make that visible in the 
tests. Optional.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to