Skip to main content
Version: 5.8

Testing Exceptions

Testing for exceptions is easy with Kotest:

val exception = shouldThrow<IllegalAccessException> {
// code in here that you expect to throw an IllegalAccessException
}
exception.message should startWith("Something went wrong")