Links for November 27th through November 30th

I love The Dumbster :)

Cobbie just turned me onto Dumbster, a really awesome tool for unit-testing applications or classes that send out email.

Dumbster is a very simple fake SMTP server designed specifically for unit and system testing applications that send email messages. It responds to all standard SMTP commands but does not actually deliver the email messages to the user. The messages are stored within Dumbster for later extraction and verification, further enhancing your unit tests, as you are able to validate sender, recipient, subject, and message content.

The Dumbster is written in Java and is open source and a must have in your testing toolbox. Thanks Cobbie and thanks Jason Kitchen for creating The Dumbster.

[source:java]
public void testTextEmail() {

String smtpHost = “localhost”;
String to = “you@yourdomain.com”;
String from = “me@mydomain.com”;
String subject = “Testing EMailUtil”;
String message = “Writing Unit tests is fun – don�t you agree ?”;
String replyTo = null;
boolean debug = true;
try {
SimpleSmtpServer server = SimpleSmtpServer.start();
EmailUtil.sendTextMail(smtpHost, to, from, subject, message, replyTo, debug);
server.stop();
assertTrue(server.getReceivedEmailSize() == 1);
Iterator emailIter = server.getReceivedEmail();
SmtpMessage email = (SmtpMessage) emailIter.next();
assertTrue(email.getHeaderValue(“Subject”).equals(subject));
assertTrue(email.getBody().equals(message));

} catch (EmailUtilException e) {
fail(“Shouldn’t get an exception”);
}
}
[/source]