File tree Expand file tree Collapse file tree 2 files changed +73
-0
lines changed
main/kotlin/org/springframework/data/r2dbc/core
test/kotlin/org/springframework/data/r2dbc/core Expand file tree Collapse file tree 2 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2018-2019 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package org.springframework.data.r2dbc.core
17
+
18
+ import kotlinx.coroutines.reactive.awaitSingle
19
+
20
+ /* *
21
+ * Coroutines variant of [UpdatedRowsFetchSpec.rowsUpdated].
22
+ *
23
+ * @author Fred Montariol
24
+ */
25
+ suspend fun UpdatedRowsFetchSpec.awaitRowsUpdated (): Int =
26
+ rowsUpdated().awaitSingle()
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2018-2019 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package org.springframework.data.r2dbc.core
17
+
18
+ import io.mockk.every
19
+ import io.mockk.mockk
20
+ import io.mockk.verify
21
+ import kotlinx.coroutines.runBlocking
22
+ import org.assertj.core.api.Assertions.assertThat
23
+ import org.junit.Test
24
+ import reactor.core.publisher.Mono
25
+
26
+ /* *
27
+ * Unit tests for [UpdatedRowsFetchSpec] extensions.
28
+ *
29
+ * @author Fred Montariol
30
+ */
31
+ class UpdatedRowsFetchSpecExtensionsTests {
32
+
33
+ @Test // gh-212
34
+ fun awaitRowsUpdatedWithValue () {
35
+
36
+ val spec = mockk<UpdatedRowsFetchSpec >()
37
+ every { spec.rowsUpdated() } returns Mono .just(42 )
38
+
39
+ runBlocking {
40
+ assertThat(spec.awaitRowsUpdated()).isEqualTo(42 )
41
+ }
42
+
43
+ verify {
44
+ spec.rowsUpdated()
45
+ }
46
+ }
47
+ }
You can’t perform that action at this time.
0 commit comments