From b03880b06665c95b0c8f88e6fb648334ab616903 Mon Sep 17 00:00:00 2001 From: Boris Petrov Date: Wed, 28 Dec 2022 11:04:13 +0200 Subject: [PATCH] Also check the file name in the UTF-8 attachment test --- .../icegreen/greenmail/specificmessages/EncodingTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/greenmail-core/src/test/java/com/icegreen/greenmail/specificmessages/EncodingTest.java b/greenmail-core/src/test/java/com/icegreen/greenmail/specificmessages/EncodingTest.java index 5e9c6319b9..899a086546 100644 --- a/greenmail-core/src/test/java/com/icegreen/greenmail/specificmessages/EncodingTest.java +++ b/greenmail-core/src/test/java/com/icegreen/greenmail/specificmessages/EncodingTest.java @@ -219,6 +219,7 @@ public void messagesAdded(MessageCountEvent e) { } }; inboxFolder.addMessageCountListener(listener); + String fileName = "кирилица testimage_ünicöde_\uD83C\uDF36"; new Thread(() -> { try { Thread.sleep(100); @@ -226,10 +227,9 @@ public void messagesAdded(MessageCountEvent e) { // Ignore } try { - String fileName = MimeUtility.encodeText("кирилица testimage_ünicöde_\uD83C\uDF36"); GreenMailUtil.sendAttachmentEmail( "to@localhost", "from@localhost", "subject", "body", - new byte[]{0, 1, 2}, "image/gif", fileName, + new byte[]{0, 1, 2}, "image/gif", MimeUtility.encodeText(fileName), "testimage_description", greenMail.getSmtp().getServerSetup()); } catch (UnsupportedEncodingException ex) { assertThat(false).isTrue(); @@ -238,6 +238,7 @@ public void messagesAdded(MessageCountEvent e) { ((IMAPFolder) inboxFolder).idle(true); assertThat(messages[0].getContent() != null).isTrue(); + assertThat(((Multipart) messages[0].getContent()).getBodyPart(1).getFileName()).isEqualTo(fileName); inboxFolder.close(); } finally {