|
|
|
|
|
by psnj
6065 days ago
|
|
Could someone explain: "Be Defensive - They're out to Get Your Code! - Defensively assert about the state of parameters passed in methods, constructors, and mid-method."? which, desarcastified, I take to mean: "Don't defensively assert about the state of parameters passed in methods, constructors, and mid-method." Specifically: "You see, there are testing freaks out there that like to instantiate your object, or call a method under test and pass in nulls" Isn't it the case that a calling a method with (say) null parameters where they are supposed to be non-null should raise an exception? Isn't an assertion failure reasonable in this case? I understood and agreed with a lot of the other stuff (although it struck me as a bit dogmatic) but this one I don't get. |
|
Agreed that the whole article would be more useful without the sarcasm.