4 ms·
> I will recommend to use Exception class and do not use specific subclasses of Exception. This will increase the test coverage also. Firstly, it doesn't incre
by ajanuary 14y ago
> I will recommend to use Exception class and do not use specific subclasses of Exception. This will increase the test coverage also.
Firstly, it doesn't increase test coverage. You're still executing the same code paths, just weakening your assertions about the methods behavior.
Secondly, even if it did, what's the point of increasing test coverage if you're not actually saying anything useful about the contracts of your methods?
Coverage isn't the end goal that you slavishly need to satisfy, it's a useful indicator of how thorough your tests are. You don't make your tests more thorough by weakening your assertions.