We use heavily JUnit Tests for testing our BPMNs.
Some BPMNs use the Activiti MailTask. This work’s great on our real environment (where we have a mail server), but for the JUnit Tests, we would like to disable the mail functionality.
Yes, we have a test engine config, but how do I get the mail server stubbed? If I leave the mail configuration blank (ProcessEngineConfiguration), I get an Connection Refused Exception
The actual logic for sending the email is the MailActivityBehavior so you could mock that in your tests.
If you’re really want to unit test in stead of a integration test.
But perhaps better (and easier) is to start a simple mail server in your tests.
Take a look how we do it when testing the MailTask.