davsclaus commented on code in PR #13678: URL: https://github.com/apache/camel/pull/13678#discussion_r1549436506
########## components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDisconnectTest.java: ########## @@ -39,14 +43,17 @@ public void testDisconnect() throws Exception { template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "A Bla bla", "Subject", "Hello A"); template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "B Bla bla", "Subject", "Hello B"); - Thread.sleep(500); - template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "C Bla bla", "Subject", "Hello C"); + Awaitility.await().pollDelay(500, TimeUnit.MILLISECONDS).untilAsserted(() -> Assertions + .assertDoesNotThrow( + () -> template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "C Bla bla", "Subject", "Hello C"))); - Thread.sleep(500); - template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "D Bla bla", "Subject", "Hello D"); + Awaitility.await().pollDelay(500, TimeUnit.MILLISECONDS).untilAsserted(() -> Assertions + .assertDoesNotThrow( + () -> template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "D Bla bla", "Subject", "Hello D"))); - Thread.sleep(500); - template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "E Bla bla", "Subject", "Hello E"); + Awaitility.await().pollDelay(500, TimeUnit.MILLISECONDS).untilAsserted(() -> Assertions + .assertDoesNotThrow( + () -> template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "E Bla bla", "Subject", "Hello E"))); Review Comment: Yes this is wrong as well, as you can risk having it send the message more than once as the code is called again ########## components/camel-mail/src/test/java/org/apache/camel/component/mail/MailDisconnectTest.java: ########## @@ -39,14 +43,17 @@ public void testDisconnect() throws Exception { template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "A Bla bla", "Subject", "Hello A"); template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "B Bla bla", "Subject", "Hello B"); - Thread.sleep(500); - template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "C Bla bla", "Subject", "Hello C"); + Awaitility.await().pollDelay(500, TimeUnit.MILLISECONDS).untilAsserted(() -> Assertions + .assertDoesNotThrow( + () -> template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "C Bla bla", "Subject", "Hello C"))); - Thread.sleep(500); - template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "D Bla bla", "Subject", "Hello D"); + Awaitility.await().pollDelay(500, TimeUnit.MILLISECONDS).untilAsserted(() -> Assertions + .assertDoesNotThrow( + () -> template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "D Bla bla", "Subject", "Hello D"))); - Thread.sleep(500); - template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "E Bla bla", "Subject", "Hello E"); + Awaitility.await().pollDelay(500, TimeUnit.MILLISECONDS).untilAsserted(() -> Assertions + .assertDoesNotThrow( + () -> template.sendBodyAndHeader(jones.uriPrefix(Protocol.smtp), "E Bla bla", "Subject", "Hello E"))); Review Comment: Yes this is wrong as well, as you can risk having it send the message more than once if the code is called again -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org