The JavaMail API is a nice, simple, and effective API. But it’s got one problem: it’s a bugger to unit test. This is mostly because (unlike most other Sun Java APIs) there are no real interfaces in place, which makes it hard to mock pieces out. An excellent solution to this problem is Dumbster