Why is this test not tautological?

KlaymenDK

This is not about explicit code, so apologies if it should have been posted elsewhere. It is, however, solidly within the domain of testing, which I assume you guys to be right at home in.

I'm reading the provocatively titled paper "Why Most Unit Testing is Waste" (21 pages) and came across this passage:

The third tests to throw away the tautological ones. [...] Testing for this being non-null on entry to a method is, by the way, not a tautological test — and can be very informative [...]

This really piqued my curiosity -- why would this ever be null on purpose? How would you even write such code?

Edit: Thank you Daniel! I don't know much C(/++/#) but my initial (Java-centric) thought was that no, it's not possible, and I seem to be right, with reference to your 2nd comment that "If you're using this, then you're in the instance so this [can't be] null."

KlaymenDK

Credit goes to @DanielDaranas.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related