winterbe / expekt

BDD assertion library for Kotlin

Home Page:http://winterbe.github.io/expekt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No way to validate thrown exceptions

C06A opened this issue · 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).

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.

No response for more than a year.

Does this mean that this project is abandoned?

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