truthish
truthish copied to clipboard
Feature Request: Support assertThrows with a message
Currently, all the assertThat methods have assertWithMessage versions.
assertThrows is kind of special and I don't think we can do quite the same thing, but there should be some way to add support for a custom message.
I had a loop in some of my code that tested several inputs against an assertThrows check, but when one of them failed, I didn't have any idea of which one. It would have been nice to do something like
for (badInput in listOf(...)) {
assertThrows<...>("Testing exceptions for input case $badInput...") { ... }
}