|
|
|
|
|
by civopsec
1279 days ago
|
|
The cool thing with all these links is that I can pick whichever one I want to talk about! > Don't use assertions. BairsLaw applies - what will you do if the assertion fails? (Fix the bug, perhaps?) If you don't like the parameters you're given, throw an IllegalArgumentException. If you don't get a correct result, your UnitTest will tell you. There is no room left for assertions. Disagree. How does the “law” apply? Yes, I would like to fix the bug if the assertion uncovers it… not unlike a validation error. Assertions are only turned on in Java if `-ea`. Which means that you can fail fast for local development and maybe just log things in production. |
|