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 1
1
package kotlinx.coroutines.experimental
2
2
3
3
import org.junit.Test
4
- import java.util.concurrent.CountDownLatch
5
- import java.util.concurrent.TimeUnit
6
4
7
- class CoroutineExceptionHandlerTest {
5
+ class CoroutineExceptionHandlerTest : TestBase () {
8
6
@Test
9
- fun testCoroutineExceptionHandlerCreator () {
10
- val latch = CountDownLatch (1 )
7
+ fun testCoroutineExceptionHandlerCreator () = runBlocking {
8
+ expect (1 )
11
9
var coroutineException: Throwable ? = null
12
-
13
10
val handler = CoroutineExceptionHandler { _, ex ->
14
11
coroutineException = ex
15
- latch.countDown( )
12
+ expect( 3 )
16
13
}
17
-
18
- launch(CommonPool + handler) {
14
+ val job = launch(CommonPool + handler) {
19
15
throw TestException ()
20
16
}
21
-
22
- latch.await( 10 , TimeUnit . SECONDS )
23
-
17
+ expect( 2 )
18
+ job.join( )
19
+ finish( 4 )
24
20
check(coroutineException is TestException )
25
21
}
26
22
}
You can’t perform that action at this time.
0 commit comments