I'm converting scala 'try/catch' testing code to use 'intercept'
Are there any scenarios where I should not use 'intercept' ? The only benefit of using 'intercept' instead of 'try/catch' is conciseness ?
I think the main difference is that intercept
has a semantic that the exception you got is expected, and not cause by program error.
So I normally only use intercept
when the test case it to test exception will throw correctly when user input it incorrect or similar scenarios.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With