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.
best regards,
jan
>> what is assertion in java?
>> thank you
>>
> verifying correct preconditions and post conditions for your methods so
> testing your software will go more smoothly

Signature
______________________________________
insOMnia - We never sleep....
http://www.insomnia-hq.de
Raymond DeCampo - 05 Jun 2005 21:21 GMT
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

Signature
XML is the programmer's duct tape.
... and a -assertion option can be specified to the compiler. If absent, the
assertions are ignored.
There's a good article here:
http://www.javaworld.com/javaworld/jw-11-2001/jw-1109-assert.html
/Jesper
>> what is assertion in java?
>> thank you
>>
> verifying correct preconditions and post conditions for your methods so
> testing your software will go more smoothly