-
-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#241: distinguish properly between TO, CC and BCC recipients when con…
…verting from Outlook messages
- Loading branch information
Showing
5 changed files
with
63 additions
and
17 deletions.
There are no files selected for viewing
Submodule angular-app
updated
from 980d1f to 7e8042
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
modules/simple-java-mail/src/test/java/org/simplejavamail/converter/EmailConverterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.simplejavamail.converter; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.junit.Test; | ||
import org.simplejavamail.api.email.Email; | ||
import org.simplejavamail.api.email.EmailAssert; | ||
import org.simplejavamail.api.email.Recipient; | ||
|
||
import java.io.File; | ||
|
||
import static demo.ResourceFolderHelper.determineResourceFolder; | ||
import static javax.mail.Message.RecipientType.CC; | ||
import static javax.mail.Message.RecipientType.TO; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.simplejavamail.internal.util.MiscUtil.normalizeNewlines; | ||
|
||
public class EmailConverterTest { | ||
|
||
private static final String RESOURCE_FOLDER = determineResourceFolder("simple-java-mail") + "/test/resources/test-messages"; | ||
|
||
@Test | ||
public void testOutlookBasicConversions() { | ||
final Recipient elias = new Recipient("Elias Laugher", "[email protected]", null); | ||
final Recipient sven = new Recipient("Sven Sielenkemper", "[email protected]", TO); | ||
final Recipient niklas = new Recipient("[email protected]", "[email protected]", CC); | ||
|
||
@NotNull Email msg = EmailConverter.outlookMsgToEmail(new File(RESOURCE_FOLDER + "/simple email with TO and CC.msg")); | ||
EmailAssert.assertThat(msg).hasFromRecipient(elias); | ||
EmailAssert.assertThat(msg).hasSubject("Test E-Mail"); | ||
EmailAssert.assertThat(msg).hasOnlyRecipients(sven, niklas); | ||
EmailAssert.assertThat(msg).hasNoAttachments(); | ||
assertThat(msg.getPlainText()).isNotEmpty(); | ||
assertThat(normalizeNewlines(msg.getHTMLText())).isEqualTo("<div dir=\"auto\">Just a test to get an email with one cc recipient.</div>\n"); | ||
assertThat(normalizeNewlines(msg.getPlainText())).isEqualTo("Just a test to get an email with one cc recipient.\n"); | ||
} | ||
} |
Binary file added
BIN
+36 KB
modules/simple-java-mail/src/test/resources/test-messages/simple email with TO and CC.msg
Binary file not shown.