use of org.simplejavamail.api.email.Recipient in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testBuilderFromAddress.
@Test
public void testBuilderFromAddress() {
final Email email = builder.from(new Recipient("lollypop", "lol.pop@somemail.com", null)).buildEmail();
assertThat(email.getFromRecipient().getName()).isEqualTo("lollypop");
assertThat(email.getFromRecipient().getAddress()).isEqualTo("lol.pop@somemail.com");
assertThat(email.getFromRecipient().getType()).isNull();
}
use of org.simplejavamail.api.email.Recipient in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testAddRecipients_Basic_Named.
@Test
public void testAddRecipients_Basic_Named() {
builder.to("name1", "1@domain.com");
builder.cc("name2", "2@domain.com,3@domain.com");
builder.bcc("name3", "4@domain.com;5@domain.com");
builder.to("name4", "6@domain.com;7@domain.com,8@domain.com");
assertThat(builder.buildEmail().getRecipients()).containsExactlyInAnyOrder(new Recipient("name1", "1@domain.com", TO), new Recipient("name2", "2@domain.com", CC), new Recipient("name2", "3@domain.com", CC), new Recipient("name3", "4@domain.com", BCC), new Recipient("name3", "5@domain.com", BCC), new Recipient("name4", "6@domain.com", TO), new Recipient("name4", "7@domain.com", TO), new Recipient("name4", "8@domain.com", TO));
}
use of org.simplejavamail.api.email.Recipient in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testAddRecipientsVarArgs_Complex_Nameless.
@Test
public void testAddRecipientsVarArgs_Complex_Nameless() {
builder.to("name1b <1@domain.com>");
builder.ccMultiple("name2b <2@domain.com>", "name3b <3@domain.com>");
assertThat(builder.getRecipients()).containsExactlyInAnyOrder(new Recipient("name1b", "1@domain.com", TO), new Recipient("name2b", "2@domain.com", CC), new Recipient("name3b", "3@domain.com", CC));
}
use of org.simplejavamail.api.email.Recipient in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testBuilderBounceToAddress.
@Test
public void testBuilderBounceToAddress() {
final Email email = builder.withBounceTo(new Recipient("lollypop", "lol.pop@somemail.com", null)).buildEmail();
assertThat(email.getBounceToRecipient().getName()).isEqualTo("lollypop");
assertThat(email.getBounceToRecipient().getAddress()).isEqualTo("lol.pop@somemail.com");
assertThat(email.getBounceToRecipient().getType()).isNull();
}
use of org.simplejavamail.api.email.Recipient in project simple-java-mail by bbottema.
the class EmailPopulatingBuilderImpl1Test method testAddRecipients_Complex_Named.
@Test
public void testAddRecipients_Complex_Named() {
builder.toWithDefaultName("name1", "name1b <1@domain.com>");
builder.ccWithDefaultName("name2", "name2b <2@domain.com>,3@domain.com");
builder.bccWithDefaultName("name3", "4@domain.com;name3b <5@domain.com>");
builder.toWithDefaultName("name4", "name4b <6@domain.com>;name5b <7@domain.com>,name6b <8@domain.com>");
assertThat(builder.buildEmail().getRecipients()).containsExactlyInAnyOrder(new Recipient("name1b", "1@domain.com", TO), new Recipient("name2b", "2@domain.com", CC), new Recipient("name2", "3@domain.com", CC), new Recipient("name3", "4@domain.com", BCC), new Recipient("name3b", "5@domain.com", BCC), new Recipient("name4b", "6@domain.com", TO), new Recipient("name5b", "7@domain.com", TO), new Recipient("name6b", "8@domain.com", TO));
}
Aggregations