I want to make sure that a given group of objects is immutable.
I was thinking about something along the lines of:
This thread can help How do I identify immutable objects in Java. Take a look at the second popular answer, it might be possible to check for any immutability problems with FindBugs. If you run it on every commit then you can call it a unit test :)
EDIT
It seems that FindBugs only check for final
, that's not much. You could implement your own rule according to you patterns and classes which you use in the code.