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 6 7 import org.junit.Test 8 import kotlin.test.* 9 10 class IODispatcherTest : TestBase() { 11 @Test <lambda>null12 fun testWithIOContext() = runTest { 13 // just a very basic test that is dispatcher works and indeed uses background thread 14 val mainThread = Thread.currentThread() 15 expect(1) 16 withContext(Dispatchers.IO) { 17 expect(2) 18 assertNotSame(mainThread, Thread.currentThread()) 19 } 20 21 expect(3) 22 assertSame(mainThread, Thread.currentThread()) 23 finish(4) 24 } 25 }