From 2b1863be728c37bbb274e953bad50a7bd2af8c71 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 --- .../greenmail/test/specificmessages/EncodingTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/greenmail-core/src/test/java/com/icegreen/greenmail/test/specificmessages/EncodingTest.java b/greenmail-core/src/test/java/com/icegreen/greenmail/test/specificmessages/EncodingTest.java index b5ce3ea623..7015ac1f67 100644 --- a/greenmail-core/src/test/java/com/icegreen/greenmail/test/specificmessages/EncodingTest.java +++ b/greenmail-core/src/test/java/com/icegreen/greenmail/test/specificmessages/EncodingTest.java @@ -210,6 +210,7 @@ public void messagesAdded(MessageCountEvent e) { } }; inboxFolder.addMessageCountListener(listener); + String fileName = "кирилица testimage_ünicöde_\uD83C\uDF36"; new Thread(() -> { try { Thread.sleep(100); @@ -217,10 +218,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(); @@ -229,6 +229,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 {