最终在Kotlin Kotest中处理多个异常
根据kotest文件: 您可以告诉最终在Kotlin Kotest中处理多个异常,kotlin,generics,exception,kotlin-multiplatform,kotest,Kotlin,Generics,Exception,Kotlin Multiplatform,Kotest,根据kotest文件: 您可以告诉最终忽略特定的异常,其他任何异常都会立即导致测试失败 我希望将多个异常传递给我知道将由我的块抛出的最终异常,以便我可以显式地跳过它们 现在我只看到了传递一个异常的方法,如何将多个异常传递给最终,以在块抛出这些异常时跳过它?您可以对所有异常使用超类,如 eventually(200.milliseconds, exceptionClass = RuntimeException::class) { throw IllegalStateException() }
最终
忽略特定的异常,其他任何异常都会立即导致测试失败
我希望将多个异常传递给我知道将由我的块抛出的最终异常,以便我可以显式地跳过它们
现在我只看到了传递一个异常的方法,如何将多个异常传递给
最终
,以在块抛出这些异常时跳过它?您可以对所有异常使用超类,如
eventually(200.milliseconds, exceptionClass = RuntimeException::class) {
throw IllegalStateException()
}
或包装异常
eventually(200.milliseconds, exceptionClass = IllegalStateException::class) {
runCatching { throw UnknownError() }
.onFailure { throw IllegalStateException(it) }
}
在4.4.3
中,没有异常集合的功能