File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed
kotlinx-coroutines-core/src/test/kotlin/kotlinx/coroutines/experimental Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change 11package kotlinx.coroutines.experimental
22
33import org.junit.Test
4- import java.util.concurrent.CountDownLatch
5- import java.util.concurrent.TimeUnit
64
7- class CoroutineExceptionHandlerTest {
5+ class CoroutineExceptionHandlerTest : TestBase () {
86 @Test
9- fun testCoroutineExceptionHandlerCreator () {
10- val latch = CountDownLatch (1 )
7+ fun testCoroutineExceptionHandlerCreator () = runBlocking {
8+ expect (1 )
119 var coroutineException: Throwable ? = null
12-
1310 val handler = CoroutineExceptionHandler { _, ex ->
1411 coroutineException = ex
15- latch.countDown( )
12+ expect( 3 )
1613 }
17-
18- launch(CommonPool + handler) {
14+ val job = launch(CommonPool + handler) {
1915 throw TestException ()
2016 }
21-
22- latch.await( 10 , TimeUnit . SECONDS )
23-
17+ expect( 2 )
18+ job.join( )
19+ finish( 4 )
2420 check(coroutineException is TestException )
2521 }
2622}
You can’t perform that action at this time.
0 commit comments