Unit testing: problems mocking coldbox.system.core.mail.Mail bean

Today I stumbled on an issue with unit testing code that makes use of
the ColdBox mail service. The root of the problem is that the Mail
bean's config method declares that it returns an object of type
'Mail'; this causes problems when needing to mock the return value of
the method (using the full component path solves the issue). For

Snippet of code to test:

Looking closer at the code, I can change the working source code to
the following and mock away without problems (because newMail() passes
on the argumentCollection and returns

emailConfig = MailService.newMail( argumentCollection =
myMailConfig );
MailService.send( emailConfig );

This is better all round :wink: