• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3  */
4 
5 package kotlinx.coroutines.rx3
6 
7 import io.reactivex.rxjava3.schedulers.Schedulers
8 import kotlinx.coroutines.*
9 import org.junit.Before
10 import org.junit.Test
11 import kotlin.test.*
12 
13 class SchedulerTest : TestBase() {
14     @Before
setupnull15     fun setup() {
16         ignoreLostThreads("RxCachedThreadScheduler-", "RxCachedWorkerPoolEvictor-", "RxSchedulerPurge-")
17     }
18 
19     @Test
<lambda>null20     fun testIoScheduler(): Unit = runBlocking {
21         expect(1)
22         val mainThread = Thread.currentThread()
23         withContext(Schedulers.io().asCoroutineDispatcher()) {
24             val t1 = Thread.currentThread()
25             assertNotSame(t1, mainThread)
26             expect(2)
27             delay(100)
28             val t2 = Thread.currentThread()
29             assertNotSame(t2, mainThread)
30             expect(3)
31         }
32         finish(4)
33     }
34 }
35