/* * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ package kotlinx.coroutines.rx3 import io.reactivex.rxjava3.schedulers.Schedulers import kotlinx.coroutines.* import org.junit.Before import org.junit.Test import kotlin.test.* class SchedulerTest : TestBase() { @Before fun setup() { ignoreLostThreads("RxCachedThreadScheduler-", "RxCachedWorkerPoolEvictor-", "RxSchedulerPurge-") } @Test fun testIoScheduler(): Unit = runBlocking { expect(1) val mainThread = Thread.currentThread() withContext(Schedulers.io().asCoroutineDispatcher()) { val t1 = Thread.currentThread() assertNotSame(t1, mainThread) expect(2) delay(100) val t2 = Thread.currentThread() assertNotSame(t2, mainThread) expect(3) } finish(4) } }