use of org.simplejavamail.api.email.Email in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testBuilderCCAddresses_ComplexFormat.
@Test
public void testBuilderCCAddresses_ComplexFormat() {
final Email email = builder.ccWithDefaultName("1", "1b <1@candyshop.org>").cc("5b <5@candyshop.org>").cc("6@candyshop.org,7b <7@candyshop.org>").cc("8b <8@candyshop.org>;9@candyshop.org").cc("10b <10@candyshop.org>;11b <11@candyshop.org>,12@candyshop.org").buildEmail();
assertThat(email.getRecipients()).containsExactlyInAnyOrder(createRecipient("1b", "1@candyshop.org", Message.RecipientType.CC), createRecipient("5b", "5@candyshop.org", Message.RecipientType.CC), createRecipient(null, "6@candyshop.org", Message.RecipientType.CC), createRecipient("7b", "7@candyshop.org", Message.RecipientType.CC), createRecipient("8b", "8@candyshop.org", Message.RecipientType.CC), createRecipient(null, "9@candyshop.org", Message.RecipientType.CC), createRecipient("10b", "10@candyshop.org", Message.RecipientType.CC), createRecipient("11b", "11@candyshop.org", Message.RecipientType.CC), createRecipient(null, "12@candyshop.org", Message.RecipientType.CC));
}
use of org.simplejavamail.api.email.Email in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testAppendText_ToEmptyText.
@Test
public void testAppendText_ToEmptyText() {
Email test = builder.appendText("test").buildEmail();
EmailAssert.assertThat(test).hasPlainText("test");
}
use of org.simplejavamail.api.email.Email in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testSignWithSmime_WithConfigObject.
@Test
public void testSignWithSmime_WithConfigObject() {
builder.signWithSmime(loadPkcs12KeyStore());
final Email email = builder.buildEmail();
assertThat(email.getPkcs12ConfigForSmimeSigning()).isNotNull();
assertThat(email.getPkcs12ConfigForSmimeSigning().getPkcs12StoreData()).isNotNull();
assertThat(email.getPkcs12ConfigForSmimeSigning().getStorePassword()).isEqualTo("letmein".toCharArray());
assertThat(email.getPkcs12ConfigForSmimeSigning().getKeyAlias()).isEqualTo("smime_test_user_alias");
assertThat(email.getPkcs12ConfigForSmimeSigning().getKeyPassword()).isEqualTo("letmein".toCharArray());
}
use of org.simplejavamail.api.email.Email in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testBuilderNotificationFlags_DefaultToReplyTo.
@Test
public void testBuilderNotificationFlags_DefaultToReplyTo() {
final Email email = builder.withReplyTo("replyTo", "1@candyshop.org").from("from", "2@candyshop.org").withDispositionNotificationTo().withReturnReceiptTo().buildEmail();
assertThat(email.isUseDispositionNotificationTo()).isTrue();
assertThat(email.isUseReturnReceiptTo()).isTrue();
assertThat(email.getDispositionNotificationTo()).isEqualTo(new Recipient("replyTo", "1@candyshop.org", null));
assertThat(email.getReturnReceiptTo()).isEqualTo(new Recipient("replyTo", "1@candyshop.org", null));
}
use of org.simplejavamail.api.email.Email in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testBuilderReturnReceiptToAddressWithFixedNameOverridingTheOneFromAddress.
@Test
public void testBuilderReturnReceiptToAddressWithFixedNameOverridingTheOneFromAddress() throws UnsupportedEncodingException {
final Email email = builder.withReturnReceiptTo("lollypop", new InternetAddress("lol.pop@somemail.com", "moo")).buildEmail();
assertThat(email.getReturnReceiptTo().getName()).isEqualTo("lollypop");
assertThat(email.getReturnReceiptTo().getAddress()).isEqualTo("lol.pop@somemail.com");
assertThat(email.getReturnReceiptTo().getType()).isNull();
}
Aggregations