Testing EJBs without a container

One of the more annoying aspects of testing EJBs has always been the fact you need to bundle them up in a JAR (and often an EAR) and deploy them to a server to thoroughly test them. This process drags out the development of unit tests, and makes life generally painful.

As of EJB 3, however, it’s no longer necessary. instead, it is fairly trivial to mock out the container entirely (and safely!)

Continue reading “Testing EJBs without a container”

Unit testing email

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

Continue reading “Unit testing email”

Unit testing privates, and other unsavoury topics

Brian Duff gives a good example of a technique to get around visibility problems when unit testing. Believe it or not, this can be a good idea (and this is a strong TDD advocate saying this).

Continue reading “Unit testing privates, and other unsavoury topics”

Test Driven Development is not bad, mkay?

Bucky, who seems to write a bile-ish blog, thinks that test driven development is bad because he doesn’t like compile errors in his code. Because of that, he suggests writing the interface first.

Continue reading “Test Driven Development is not bad, mkay?”