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.
The @Ignore annotation helps in this scenario. A test method annotated with @Ignore will not be executed. If a test class is annotated with @Ignore, then none of its test methods will be executed.
JUnit tests can be run automatically and they check their own results and provide immediate feedback.
Creating a New Test Class We can create a new test class by simply creating a public class. Even though there is no “official” naming convention, the most common way to name a unit test class is to add the suffix Test to the name of the tested class or unit. JUnit 4 requires that all test classes are public .
Alternative answer: Dumbster is a fake SMTP server designed for testing against. It's written in Java.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With