JUnit 5 `Assertions.assertThrows` doesn't work if ...
# coroutines
d
JUnit 5
Assertions.assertThrows
doesn't work if the block calls a suspend function, because the (Java) function isn't
inline
. What do people do here? Write their own version?
o
You should add the
kotlin-test-junit5
, it has inline
assertFails
d
Hmm I'm seeing assertFailedWith in kotlin.test, a library I don't use. Can I just use a few assertions from this library without totally rewriting all my tests?
o
yes, they're meant to just be cross-platform compatible, so the kotlin-test ones are platform independent, but on JVM can use JUnit / AssertionError
d
Great. Wasn't sure if I have to switch to using their annotations and such too
334 Views