Join Slack
Powered by
I thought assertFailsWith should fail when wrong e...
# kotlin-native
p
pernilla
10/05/2023, 8:52 AM
I thought assertFailsWith should fail when wrong exception is caught, but this seems to be successful: val block: () -> Unit =
{
“a string”._toInt_()
}
_assertFailsWith_<IllegalArgumentException>(block = block) What am I missing?
m
Mikael Stockman
10/05/2023, 8:56 AM
NumberFormatException
inherits from
IllegalArgumentException
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-number-format-exception/
Which likely is why the test passes
👍 1
Open in Slack
Previous
Next