public void testMailNoRecipients() throws Exception {
try {
template.sendBody("direct:a", "Hello World");
fail("Should have thrown exception");
} catch (CamelExecutionException e) {
MailPreparationException mpe = assertIsInstanceOf(MailPreparationException.class, e.getCause());
IllegalArgumentException iae = assertIsInstanceOf(IllegalArgumentException.class, mpe.getCause());
assertEquals("The mail message does not have any recipients set.", iae.getMessage());
}
}