Search code examples
javaunit-testingemailjunit

Running Junit Email Tests Without Emails Actually Going Out


I want to run unit tests (Junit) on some model classes that typically will send emails confirming that things happened. Is there a mock email server that you can use with unit tests that will let you confirmation that your run tried to send an email without actually sending the emails out?

This seems like it would be a nice to have, just not sure I want to write my own. The app stack for the emailing aspect is Velocity+Spring, so it would be preferable if the test server can be pointed at by simply changing the applicationContext.xml file.


Solution

  • Dumbster is a fake SMTP server designed for testing against. It's written in Java.