Skip to content

Commit f587b4e

Browse files
committed
Added junit test for testing multiple nested MimeMessages with the same name (or actually with missing names, defaulting to the same name)
1 parent b695737 commit f587b4e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

modules/simple-java-mail/src/test/java/org/simplejavamail/converter/EmailConverterTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,30 @@ public void accept(final Properties passwords) {
9292
}
9393
});
9494
}
95+
96+
@Test
97+
public void testMimeMessageWithNestedMessages()
98+
throws Exception {
99+
SecureTestDataHelper.runTestWithSecureTestData(new SecureTestDataHelper.PasswordsConsumer() {
100+
@Override
101+
public void accept(final Properties passwords) {
102+
String fileNameMsg = RESOURCES + "/secure-testdata/secure-testdata/nested-mimemessages-without-name-email/4990344.eml";
103+
Email email = EmailConverter.emlToEmail(new File(fileNameMsg));
104+
assertThat(email.getAttachments()).extracting("name").containsExactly("ForwardedMessage.eml", "ForwardedMessage.eml");
105+
}
106+
});
107+
}
108+
109+
@Test
110+
public void testOutlookMessageWithNestedMessages()
111+
throws Exception {
112+
SecureTestDataHelper.runTestWithSecureTestData(new SecureTestDataHelper.PasswordsConsumer() {
113+
@Override
114+
public void accept(final Properties passwords) {
115+
String fileNameMsg = RESOURCES + "/secure-testdata/secure-testdata/nested-mimemessages-without-name-email/4990344.msg";
116+
Email email = EmailConverter.outlookMsgToEmail(new File(fileNameMsg));
117+
assertThat(email.getAttachments()).extracting("name").containsExactly("NDPB.eml", "Voicemail .eml");
118+
}
119+
});
120+
}
95121
}
Binary file not shown.

0 commit comments

Comments
 (0)