Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shouldNotThrow not working #128

Closed
svenjacobs opened this issue Dec 19, 2018 · 4 comments
Closed

shouldNotThrow not working #128

svenjacobs opened this issue Dec 19, 2018 · 4 comments

Comments

@svenjacobs
Copy link

Kluent: 1.44
Kotlin: 1.3.11

shouldNotThrow isn't working at all for me. The following code does not fail:

val fn = {
    throw Exception("")
}

fn shouldNotThrow Exception::class

I think the problem is in this line. isAnyException() performs a comparison of javaObjectType of the current exception object with AnyException.javaObjectType. These types are never the same.

image

@svenjacobs
Copy link
Author

I think this bug was introduced with commit 5f51c61 where the code

if (e.isA(expectedException))
    fail("Expected ${expectedException.javaObjectType} to not be thrown", "${expectedException.javaObjectType}", "${e.javaClass}")

was removed.

@MarkusAmshove
Copy link
Owner

Thank you for reporting, I'll have a look.
I had to fiddle with Exceptions to try and get them working within the common module (which didn't work), so I guess that line went missing :-/

@MarkusAmshove
Copy link
Owner

You're right, that was the problem.

I've fixed it and released v1.45, you can try it out

@svenjacobs
Copy link
Author

Yes, it was fixed with version 1.45. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants