Upgrade to Coroutines 1.4.0-M1 and use awaitSingle()

This commit raises the minimum Coroutines version supported
to 1.4.0-M1 and above, and changes usages of awaitFirst() or
awaitFirstOrNull() to awaitSingle() or awaitSingleOrNull()
to fix gh-25007.

Closes gh-25914
Closes gh-25007
This commit is contained in:
Sébastien Deleuze
2020-10-13 15:23:38 +02:00
parent cd835b3124
commit 3ed8813bbf
14 changed files with 38 additions and 38 deletions

View File

@@ -98,7 +98,7 @@ class RowsFetchSpecExtensionsTests {
every { spec.first() } returns Mono.just("foo")
runBlocking {
assertThat(spec.awaitFirst()).isEqualTo("foo")
assertThat(spec.awaitSingle()).isEqualTo("foo")
}
verify {
@@ -112,7 +112,7 @@ class RowsFetchSpecExtensionsTests {
every { spec.first() } returns Mono.empty()
assertThatExceptionOfType(EmptyResultDataAccessException::class.java).isThrownBy {
runBlocking { spec.awaitFirst() }
runBlocking { spec.awaitSingle() }
}
verify {
@@ -121,12 +121,12 @@ class RowsFetchSpecExtensionsTests {
}
@Test
fun awaitFirstOrNullWithValue() {
fun awaitSingleOrNullWithValue() {
val spec = mockk<RowsFetchSpec<String>>()
every { spec.first() } returns Mono.just("foo")
runBlocking {
assertThat(spec.awaitFirstOrNull()).isEqualTo("foo")
assertThat(spec.awaitSingleOrNull()).isEqualTo("foo")
}
verify {
@@ -135,12 +135,12 @@ class RowsFetchSpecExtensionsTests {
}
@Test
fun awaitFirstOrNullWithNull() {
fun awaitSingleOrNullWithNull() {
val spec = mockk<RowsFetchSpec<String>>()
every { spec.first() } returns Mono.empty()
runBlocking {
assertThat(spec.awaitFirstOrNull()).isNull()
assertThat(spec.awaitSingleOrNull()).isNull()
}
verify {