orpiske commented on code in PR #13678: URL: https://github.com/apache/camel/pull/13678#discussion_r1549846065
########## components/camel-mail/src/test/java/org/apache/camel/component/mail/MailAttachmentsUmlautIssueTest.java: ########## @@ -71,28 +73,28 @@ public void testSendAndReceiveMailWithAttachments() throws Exception { producer.process(exchange); // need some time for the mail to arrive on the inbox (consumed and sent to the mock) - Thread.sleep(2000); - - MockEndpoint mock = getMockEndpoint("mock:result"); - mock.expectedMessageCount(1); - Exchange out = mock.assertExchangeReceived(0); - mock.assertIsSatisfied(); - - // plain text - assertEquals("Hello World", out.getIn().getBody(String.class)); - - // attachment - Map<String, DataHandler> attachments = out.getIn(AttachmentMessage.class).getAttachments(); - assertNotNull(attachments, "Should have attachments"); - assertEquals(1, attachments.size()); - - DataHandler handler = out.getIn(AttachmentMessage.class).getAttachment(name); - assertNotNull(handler, "The " + name + " should be there"); - - String nameURLEncoded = URLEncoder.encode(name, Charset.defaultCharset().name()); - assertTrue(handler.getContentType().endsWith(nameURLEncoded), "Handler content type should end with URL-encoded name"); - - assertEquals(name, handler.getName(), "Handler name should be the file name"); + Awaitility.await().pollDelay(2, TimeUnit.SECONDS).untilAsserted(() -> { + MockEndpoint mock = getMockEndpoint("mock:result"); Review Comment: Setting up the expectations should be done outside the untilAsserted. In general we should have only the assertion code within that. Can you adjust this, please? -- 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