expekt icon indicating copy to clipboard operation
expekt copied to clipboard

No way to validate thrown exceptions

Open C06A opened this issue 7 years ago • 3 comments

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).

C06A avatar Dec 11 '17 14:12 C06A

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.

C06A avatar Dec 11 '17 14:12 C06A

No response for more than a year.

Does this mean that this project is abandoned?

C06A avatar Jun 23 '19 12:06 C06A

I'm sorry to say that this project is no longer actively maintained by me.

winterbe avatar Jun 24 '19 07:06 winterbe