Results 1 to 5 of 5

Thread: Testing E-mail

  1. #1
    Join Date
    Jun 2005
    Posts
    7

    Default Testing E-mail

    Hi, everyone

    One of the things I like about Dependency Injection is how easy is to test the application. Specially when you use interfaces, it´s just a case of mocking the interface. I have an issue about testing sending e-mail. When you´re using Spring MailSender interface this is quite simple. But when you have to send MimeMessage's you have a problem, because JavaMail use classes instead of interfaces. How do you test e-mail in your applications? I've read about creating a mock smtp server, but I hope there is a more easy alternative.

    Rgds,

    Rui

  2. #2
    Join Date
    Jan 2005
    Location
    Toronto, ON
    Posts
    8

    Default

    I have been using the Dumbster mock SMTP server to test my email:

    http://quintanasoft.com/dumbster/

    It is lightweight enough to be used with junit.

  3. #3
    Join Date
    Oct 2004
    Location
    Herndon, VA, US
    Posts
    648

    Default

    Have you looked at jMock's cglib extension which allows mocking concrete classes?
    --Jing Xue

  4. #4
    Join Date
    Jun 2005
    Posts
    7

    Default

    Thanks Patrick.

    Dumbster is really cool.

  5. #5
    Join Date
    Sep 2006
    Location
    Work in New York City
    Posts
    127

    Exclamation instead of Dumbster is better to use org.subethamail.wiser.Wiser

    Quote Originally Posted by Patrick Bourke View Post
    I have been using the Dumbster mock SMTP server to test my email:

    http://quintanasoft.com/dumbster/

    It is lightweight enough to be used with junit.
    I went through a lot of pain using Dumbster until I discovered a Dumbster replacement written by someone who got frustrated with the bugs in Dumbster.
    Below is the comment I placed in the program I wrote that originally used Dumbster:

    * The first version of this program used the open source Dumbster mock mail server.
    * However a robust, well-written open source alternative was later found and the program was re-written to use org.subethamail.wiser.Wiser instead of Dumbster.
    * Wiser, according to their web site, is quote, "a smart replacement for Dumbster".
    * For more information see: http://subethasmtp.tigris.org/wiser.html
    Java Developer with all the usual Sun Java certifications.

Similar Threads

  1. Spring-based Mail Template Framework
    By eisenb in forum Architecture
    Replies: 3
    Last Post: Dec 2nd, 2010, 07:24 AM
  2. JDO Transactions and JUnit testing
    By markds75 in forum Data
    Replies: 2
    Last Post: Sep 17th, 2005, 01:46 AM
  3. mail and authentication
    By lixin_chu in forum Container
    Replies: 0
    Last Post: Mar 15th, 2005, 08:40 AM
  4. Please help! Unit testing code for JPetStore
    By lakershen in forum Container
    Replies: 4
    Last Post: Jan 13th, 2005, 05:00 PM
  5. Replies: 2
    Last Post: Jan 6th, 2005, 02:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •