File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
src/test/kotlin/com/github/michaelbull/jdbc/context Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package com.github.michaelbull.jdbc.context
22
33import io.mockk.mockk
44import kotlinx.coroutines.ExperimentalCoroutinesApi
5- import kotlinx.coroutines.runBlocking
5+ import kotlinx.coroutines.test.runBlockingTest
66import org.junit.jupiter.api.Assertions.assertEquals
77import org.junit.jupiter.api.Test
88import org.junit.jupiter.api.assertThrows
@@ -14,15 +14,17 @@ class CoroutineConnectionTest {
1414 @Test
1515 fun `connection throws IllegalStateException if not in context` () {
1616 assertThrows<IllegalStateException > {
17- runBlocking { coroutineContext.connection }
17+ runBlockingTest {
18+ coroutineContext.connection
19+ }
1820 }
1921 }
2022
2123 @Test
2224 fun `connection returns connection if in context` () {
2325 val expected = mockk<Connection >()
2426
25- runBlocking (CoroutineConnection (expected)) {
27+ runBlockingTest (CoroutineConnection (expected)) {
2628 val actual = coroutineContext.connection
2729 assertEquals(expected, actual)
2830 }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package com.github.michaelbull.jdbc.context
22
33import io.mockk.mockk
44import kotlinx.coroutines.ExperimentalCoroutinesApi
5- import kotlinx.coroutines.runBlocking
5+ import kotlinx.coroutines.test.runBlockingTest
66import org.junit.jupiter.api.Assertions
77import org.junit.jupiter.api.Test
88import org.junit.jupiter.api.assertThrows
@@ -14,15 +14,17 @@ class CoroutineDataSourceTest {
1414 @Test
1515 fun `dataSource throws IllegalStateException if not in context` () {
1616 assertThrows<IllegalStateException > {
17- runBlocking { coroutineContext.dataSource }
17+ runBlockingTest {
18+ coroutineContext.dataSource
19+ }
1820 }
1921 }
2022
2123 @Test
2224 fun `dataSource returns connection if in context` () {
2325 val expected = mockk<DataSource >()
2426
25- runBlocking (CoroutineDataSource (expected)) {
27+ runBlockingTest (CoroutineDataSource (expected)) {
2628 val actual = coroutineContext.dataSource
2729 Assertions .assertEquals(expected, actual)
2830 }
You can’t perform that action at this time.
0 commit comments