Jan Thom wrote:
well the drawback of this is having your code cluttered with asserts all
over the place. it is possibly better to have a testing framework (like
junit) in place.
JUnit and asserts are not exactly equivalent technologies. How can you
write a JUnit test that ensures that a particular method is never called
with a null value? (Certainly not in any way that JUnit is typically used.)
Having code with asserts can be very helpful, as it is self documenting.
If you see a method that takes a parameter x and you see an assert
that x is not null, you know that the caller is responsible for not
passing null values to the method. Asserts lay out the assumptions made
by the code that follows.
Ray
--
XML is the programmer's duct tape.