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.reactor
6 
7 import kotlinx.coroutines.*
8 import org.junit.Before
9 import org.junit.Test
10 import reactor.core.scheduler.Schedulers
11 import kotlin.test.*
12 
13 class SchedulerTest : TestBase() {
14     @Before
setupnull15     fun setup() {
16         ignoreLostThreads("single-")
17     }
18 
19     @Test
<lambda>null20     fun testSingleScheduler(): Unit = runBlocking {
21         expect(1)
22         val mainThread = Thread.currentThread()
23         withContext(Schedulers.single().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 }