Skip to content

Commit 1e95db6

Browse files
committed
More robust check in assertCallsExceptionHandlerWith
1 parent e5f4d63 commit 1e95db6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

reactive/kotlinx-coroutines-reactive/test/IntegrationTest.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,17 @@ class IntegrationTest(
216216
private suspend inline fun <reified E: Throwable> assertCallsExceptionHandlerWith(
217217
crossinline operation: suspend () -> Unit): E
218218
{
219-
var caughtException: Throwable? = null
219+
val caughtExceptions = mutableListOf<Throwable>()
220220
val exceptionHandler = object: AbstractCoroutineContextElement(CoroutineExceptionHandler),
221221
CoroutineExceptionHandler
222222
{
223223
override fun handleException(context: CoroutineContext, exception: Throwable) {
224-
caughtException = exception
224+
caughtExceptions += exception
225225
}
226226
}
227227
return withContext(exceptionHandler) {
228228
operation()
229-
caughtException.let {
229+
caughtExceptions.single().let {
230230
assertTrue(it is E)
231231
it
232232
}

0 commit comments

Comments
 (0)