kotest-assertions / io.kotest.assertions / createAssertionError

createAssertionError

fun createAssertionError(message: String, cause: Throwable?): AssertionError

Creates an AssertionError from the given message. If the platform supports nested exceptions, the cause is set to the given cause. If the platform supports stack traces, then the stack is cleaned of io.kotest lines.

fun createAssertionError(message: String, cause: Throwable?, expected: Expected, actual: Actual): Throwable

Creates the best error type supported on the platform (eg opentest4j.AssertionFailedException) from the given message and expected and actual values. If the platform supports nested exceptions, the cause is set to the given cause.

If the platform has jUnit4 or jUnit5 on the classpath, it will use exceptions from those platforms.