JUnit Gotcha!

October 24, 2008

I’m in the process of getting the newly separated cmlxom library ready for release. As I’m an obsessive upgrader I decided to update the junit library cmlxom uses from 4.3 to 4.5. And a load of tests broke. What?

The reason: <code>Assert.assertEquals(double, double)</code> has been deprecated for a while, replaced by <code>Assert.assertEquals(double expected, double actual, double delta)</code>, and rightly so. Instead of removing <code>Assert.assertEquals(double, double></code> they chose to make it throw AssertionFailed.

Moral of the tale: examine deprecation warnings before upgrading dependencies!