-
Notifications
You must be signed in to change notification settings - Fork 180
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
Handle expected exception #89
Comments
For now you definitely can use plain |
If you use https://github.com/npryce/hamkrest you can do: assertThat({throw ExampleException("testing")}, throws<ExampleException>())
// negation
assertThat({ /* do something */ }, !throws<Throwable>()) |
One of Spek's transitive dependencies is assertFailsWith<IllegalStateException> {
check(false)
} See kotlin/kotlin/test/TestAssertions.kt and kotlin.jvm/kotlin/test/TestAssertionsJVM.kt. |
encodeering
added a commit
to encodeering/conflate
that referenced
this issue
Feb 12, 2017
* following a suggestion from kotlin test with a reified syntax NOTE * spekframework/spek#89
encodeering
added a commit
to encodeering/conflate
that referenced
this issue
Feb 13, 2017
* following a suggestion from kotlin test with a reified syntax NOTE * spekframework/spek#89
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to write tests where specific exception is expected, like using
@Test(expected = UnhandledException::class)
from JUnit ?Thanks!
The text was updated successfully, but these errors were encountered: