• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package kotlinx.coroutines.reactor
2 
3 import kotlinx.coroutines.testing.*
4 import kotlinx.coroutines.*
5 import org.junit.Before
6 import org.junit.Test
7 import reactor.core.scheduler.Schedulers
8 import kotlin.test.*
9 
10 class SchedulerTest : TestBase() {
11     @Before
setupnull12     fun setup() {
13         ignoreLostThreads("single-")
14     }
15 
16     @Test
<lambda>null17     fun testSingleScheduler(): Unit = runBlocking {
18         expect(1)
19         val mainThread = Thread.currentThread()
20         withContext(Schedulers.single().asCoroutineDispatcher()) {
21             val t1 = Thread.currentThread()
22             assertNotSame(t1, mainThread)
23             expect(2)
24             delay(100)
25             val t2 = Thread.currentThread()
26             assertNotSame(t2, mainThread)
27             expect(3)
28         }
29         finish(4)
30     }
31 }