You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seams that framwork doesn't provide any way to check that tested code throws exception of specific kind. I guess test code can use try/catch, do fail if rich the end of try and do assertions in the catch clause. However this seams clunky and won't give correct nice message in case of failure.
I think the syntax for exceptions could be: expect(MyException::class).thrownBy {...}
If thrownBy returns the exception following code can validate details about it (message, cause, etc.).
Alternative syntax may be expect {...}.throws(MyException::class).
The text was updated successfully, but these errors were encountered:
Actually I noticed the Pull Request from Dec 17, 2016 providing exception validation. It would be grate to merge it ASAP.
However it doesn't provide the way to check message, localized message, cause and whatever else exception may encapsulate. So consider this Issue to be enhancement on top of that merge.
It seams that framwork doesn't provide any way to check that tested code throws exception of specific kind. I guess test code can use try/catch, do fail if rich the end of try and do assertions in the catch clause. However this seams clunky and won't give correct nice message in case of failure.
I think the syntax for exceptions could be:
expect(MyException::class).thrownBy {...}
If thrownBy returns the exception following code can validate details about it (message, cause, etc.).
Alternative syntax may be
expect {...}.throws(MyException::class)
.The text was updated successfully, but these errors were encountered: