Nelz's Blog

Mah blogginess

Announcing JECTU - the Java Equals Contract Test Utility

For the last couple of months, I’ve been writing tests for a bunch of domain objects. One of the big things when dealing with domain objects is dealing with identity. The equals(Object obj) and hashCode() methods are the two major levers a Java programmer has when dealing with identity.

There is a lot of overhead when testing equality in Java. There is an explicit set of characteristics (reflexive, transitive, consistent, symmetric) that a well-written equals method must adhere to, and I got tired of writing similar code, over and over again to test this code.

So, as I have heard many a time, as soon as I got tired of doing something over an over again, I wrote a utility to help me.

I have gotten to a decent starting point and wanted to open source my efforts. So, I now present to you: JECTU - the Java Equals Contract Test Utility.

Yes, I have quite a ways to go before it is a first-class test utility, but it is now in a usable state, so I thought I’d share it out now. In the future, I may find a home for it on SourceForge or on Google Code, but for now, I’m just going to host it here.

I am also still trying to figure out the Maven site publishing, and how to add extra pages to the static site output, so the download link is not mentioned in the Maven output. Here are the corresponding links:

Let me know if you have any questions or suggestions!

Update 20071112: I have changed the directory structure around a bit, and I updated the links here to reflect the new structure.