The Artima Developer Community
Sponsored Link

Java Buzz Forum
I love The Dumbster :)

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Vinny Carpenter

Posts: 276
Nickname: vscarpente
Registered: Feb, 2003

Vinny is a Java developer/architect working with Java, J2EE, OO, Linux, OpenSource.
I love The Dumbster :) Posted: Feb 3, 2005 2:08 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Vinny Carpenter.
Original Post: I love The Dumbster :)
Feed Title: Vinny Carpenter's Blog
Feed URL: http://www.j2eegeek.com/error.html
Feed Description: Welcome to my blog. I am a total Java geek that lives in Milwaukee, making my living as an architect/developer, spending all my time with Java, J2EE, OO, Linux, and open source. In my spare time, when I am not in front of my computers, I spend every other minute with my other loves: My wife, books, music, guitars, Formula-1 racing and StarGate. Check out my blog @ http://www.j2eegeek.com/blog
Latest Java Buzz Posts
Latest Java Buzz Posts by Vinny Carpenter
Latest Posts From Vinny Carpenter's Blog

Advertisement

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.



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");
}
}

Read: I love The Dumbster :)

Topic: A team of crack developers does not a successful project make Previous Topic   Next Topic Topic: Creating playful users...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use