junit.junit4.CoroutinesTimeoutStatement.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlinx-coroutines-debug Show documentation
Show all versions of kotlinx-coroutines-debug Show documentation
Coroutines support libraries for Kotlin
package kotlinx.coroutines.debug.junit4
import kotlinx.coroutines.debug.*
import org.junit.runner.*
import org.junit.runners.model.*
import java.util.concurrent.*
internal class CoroutinesTimeoutStatement(
private val testStatement: Statement,
private val testDescription: Description,
private val testTimeoutMs: Long,
private val cancelOnTimeout: Boolean = false
) : Statement() {
override fun evaluate() {
try {
runWithTimeoutDumpingCoroutines(testDescription.methodName, testTimeoutMs, cancelOnTimeout,
{ TestTimedOutException(testTimeoutMs, TimeUnit.MILLISECONDS) })
{
testStatement.evaluate()
}
} finally {
DebugProbes.uninstall()
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy