Open
Description
Describe the bug
Using:
kotlin = "2.1.20"
coroutine = "1.10.2"
In my test class if I use runTest
I get the error:
java.lang.ClassCastException: class kotlinx.coroutines.test.TestCoroutineScheduler$timeSource$1 cannot be cast to class kotlin.time.TimeSource$WithComparableMarks (kotlinx.coroutines.test.TestCoroutineScheduler$timeSource$1 and kotlin.time.TimeSource$WithComparableMarks are in unnamed module of loader 'app')
at kotlinx.coroutines.test.TestCoroutineScheduler.<init>(TestCoroutineScheduler.kt:222)
at kotlinx.coroutines.test.TestCoroutineDispatchersKt.StandardTestDispatcher(TestCoroutineDispatchers.kt:142)
at kotlinx.coroutines.test.TestCoroutineDispatchersKt.StandardTestDispatcher$default(TestCoroutineDispatchers.kt:137)
at kotlinx.coroutines.test.TestScopeKt.withDelaySkipping(TestScope.kt:196)
at kotlinx.coroutines.test.TestScopeKt.TestScope(TestScope.kt:163)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt.runTest-8Mi8wO0(TestBuilders.kt:167)
at kotlinx.coroutines.test.TestBuildersKt.runTest-8Mi8wO0(Unknown Source)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt.runTest-8Mi8wO0$default(TestBuilders.kt:159)
at kotlinx.coroutines.test.TestBuildersKt.runTest-8Mi8wO0$default(Unknown Source)
However if use runBlocking
instead the test run as expected.
Note that, and I don't know if the following is related, if I use kotlin.time.Clock
like Clock.System.now(), i get the following error:
java.lang.NoSuchMethodError: 'kotlin.time.Clock kotlin.internal.PlatformImplementations.getSystemClock()'
at kotlin.time.InstantJvmKt.<clinit>(InstantJvm.kt:12)
at kotlin.time.Clock$System.now(Clock.kt:60)