assertEquals("john.doe@example.net", ((Mailbox) m.getBcc().get(0))
.getAddress());
}
public void testSetBcc() throws Exception {
MessageImpl m = new MessageImpl();
Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
Group group = new Group("Does", mailbox1, mailbox2);
Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
m.setBcc(group);
assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
.getHeader().getField("Bcc").getBody());
m.setBcc(group, mailbox3);
assertEquals("Does: john.doe@example.net, jane.doe@example.net;, "
+ "Mary Smith <mary@example.net>", m.getHeader()
.getField("Bcc").getBody());
m.setBcc(Arrays.asList(group, mailbox3));
assertEquals("Does: john.doe@example.net, jane.doe@example.net;, "
+ "Mary Smith <mary@example.net>", m.getHeader()
.getField("Bcc").getBody());
m.setBcc((Mailbox) null);
assertNull(m.getHeader().getField("Bcc"));
}