assertEquals("john.doe@example.net", m.getFrom().get(0).getAddress());
}
public void testSetFrom() throws Exception {
MessageImpl m = new MessageImpl();
Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
m.setFrom(mailbox1);
assertEquals("john.doe@example.net", m.getHeader().getField("From")
.getBody());
m.setFrom(mailbox1, mailbox2);
assertEquals("john.doe@example.net, jane.doe@example.net", m
.getHeader().getField("From").getBody());
m.setFrom(Arrays.asList(mailbox1, mailbox2));
assertEquals("john.doe@example.net, jane.doe@example.net", m
.getHeader().getField("From").getBody());
m.setFrom((Mailbox) null);
assertNull(m.getHeader().getField("From"));
}