I personally like the idea of Design By Contract very much. The bad news is that Java does not support this natively.
The good news is that there are several libraries out there that try to implement DBC for Java:
Another bad news is that most of these projects are inactive or don’t support all aspects of DBC.
Most feature complete is the Java Modeling Language (JML). There are many tools based on this behavioral interface specification language. I checked some of them but they all seem to be very Academic and not very handy to use.
Now there is a more practical approach that uses annotations to express pre conditions, post conditions and invariants:
A detailed report that introduces the ideas behind the framework can be found here.
This looks very promising and is definitely worth giving it a try!