On Cedric’s latest entry he complains about statics, and quite rightly. However, one of the commentators missed the point.
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
“Pass-the-parcel” exceptions.
Hani makes a surprisingly unbilish point about wrapped exceptions Wrapping already wrapped exceptions isn’t the best idea in the world.
This technique reminds me of the children’s game of “Pass the Parcel”, where you put multiple layers of wrapping on a gift, and the children never know when they will reach the last one.
I’m as guilty of this as the next person, but I think in future I will modify the constructors of my wrapping exceptions so that if a cause already exists, it uses that as the cause, not the one supplied…
(FWIW, I’m not against wrapping exceptions; what is an ObjectNotFound at one layer is a ConfigurationException at another, and should be reflected as such).
This may, of course, just be a stupid idea, but it’s worth exploring.
Recognition gap
Esther Derby describes a notice from Gallup about the lack of recognition and appreciation in modern companies.
Don’t Overcomplicate Things
A gentle reminder to myself: don’t make things more complicated than they need to be.
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”
Python Paradox makes sense…
Paul Graham wrote about The Python Paradox. Unlike his earlier talk, this one actually had a good point.
Why it’s important to be able to unit test outside the container
Daniel Steinberg has a “note on Java.Net”:http://weblogs.java.net/pub/wlg/1732 about testing EJBs out of the container, and wonders why people make a fuss about it. There’s a simple reason: speed.
Daniel Steinberg has a “note on Java.Net”:http://weblogs.java.net/pub/wlg/1732 about testing EJBs out of the container, and wonders why people make a fuss about it. There’s a simple reason: speed.
Continue reading “Why it’s important to be able to unit test outside the container”
Beware of unlocalised JREs
This is a cautionary tale of US-only JREs and non-US countries, such as The Lucky Country I call home.
Continue reading “Beware of unlocalised JREs”
Ant 1.6.2 doesn’t work on Java 1.4.1
Little warning for anyone else who stumbles across this problem: the stylesheet used for <junitreport> in Ant 1.6.2 does not work with Xalan 2.2. Unfortunately, this is the version that’s bundled inside the rt.jar in Java 1.4.1.
