template.sendBodyAndHeader("direct:a", "Hello World", "Subject", "Hello a");
template.sendBodyAndHeader("direct:b", "Bye World", "Subject", "Hello b");
template.sendBodyAndHeader("direct:c", "Hi World", "Subject", "Hello c");
Mailbox boxA = Mailbox.get("a@a.com");
assertEquals(1, boxA.size());
assertEquals("Hello a", boxA.get(0).getSubject());
assertEquals("Hello World", boxA.get(0).getContent());
assertEquals("me@me.com", boxA.get(0).getFrom()[0].toString());
assertEquals("spy@spy.com", boxA.get(0).getRecipients(Message.RecipientType.CC)[0].toString());
Mailbox boxB = Mailbox.get("b@b.com");
assertEquals(1, boxB.size());
assertEquals("Hello b", boxB.get(0).getSubject());
assertEquals("Bye World", boxB.get(0).getContent());
assertEquals("you@you.com", boxB.get(0).getFrom()[0].toString());
assertEquals("spy@spy.com", boxB.get(0).getRecipients(Message.RecipientType.CC)[0].toString());
Mailbox boxC = Mailbox.get("c@c.com");
assertEquals(1, boxC.size());
assertEquals("Hello c", boxC.get(0).getSubject());
assertEquals("Hi World", boxC.get(0).getContent());
assertEquals("me@me.com", boxC.get(0).getFrom()[0].toString());
assertEquals("you@you.com", boxC.get(0).getRecipients(Message.RecipientType.CC)[0].toString());
assertEquals("them@them.com", boxC.get(0).getRecipients(Message.RecipientType.CC)[1].toString());
// no spy as its overridden by endpoint
}