Skip to content

Commit

Permalink
Also check the file name in the UTF-8 attachment test
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-petrov committed Dec 28, 2022
1 parent 4d3f514 commit 2b1863b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,17 @@ public void messagesAdded(MessageCountEvent e) {
}
};
inboxFolder.addMessageCountListener(listener);
String fileName = "кирилица testimage_ünicöde_\uD83C\uDF36";
new Thread(() -> {
try {
Thread.sleep(100);
} catch (InterruptedException e1) {
// 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();
Expand All @@ -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 {
Expand Down

0 comments on commit 2b1863b

Please sign in to comment.