-
Couldn't load subscription status.
- Fork 287
Labels
Description
I have seen developers doing this pattern a lot.
try
{
// code that throws
}
catch
{
// do some asserts.
}The developer intent is usually "assert that the code throws, and assert some stuff later" (assertions may or may not use the exception object).
The reality is, this doesn't really assert that the code throws. If the code didn't throw at all, the test will still pass.
Such patterns make the tests very hard to read and understand, and can easily lead to bugs in production that are not caught by tests.
FYI @stan-sz :)
stan-sz and pladeCopilot