@@ -21,7 +21,8 @@ import io.mockk.verify
21
21
import kotlinx.coroutines.FlowPreview
22
22
import kotlinx.coroutines.flow.toList
23
23
import kotlinx.coroutines.runBlocking
24
- import org.assertj.core.api.Assertions
24
+ import org.assertj.core.api.Assertions.assertThat
25
+ import org.assertj.core.api.Assertions.assertThatExceptionOfType
25
26
import org.junit.Test
26
27
import org.springframework.data.cassandra.domain.Person
27
28
import org.springframework.data.cassandra.domain.User
@@ -32,6 +33,7 @@ import reactor.core.publisher.Mono
32
33
* Unit tests for [ReactiveSelectOperationExtensions].
33
34
*
34
35
* @author Mark Paluch
36
+ * @author Sebastien Deleuze
35
37
*/
36
38
class ReactiveSelectOperationExtensionsUnitTests {
37
39
@@ -74,7 +76,7 @@ class ReactiveSelectOperationExtensionsUnitTests {
74
76
every { find.one() } returns Mono .just(" foo" )
75
77
76
78
runBlocking {
77
- Assertions . assertThat(find.awaitOne()).isEqualTo(" foo" )
79
+ assertThat(find.awaitOne()).isEqualTo(" foo" )
78
80
}
79
81
80
82
verify {
@@ -88,7 +90,7 @@ class ReactiveSelectOperationExtensionsUnitTests {
88
90
val find = mockk<ReactiveSelectOperation .TerminatingSelect <String >>()
89
91
every { find.one() } returns Mono .empty()
90
92
91
- Assertions . assertThatExceptionOfType(NoSuchElementException ::class .java).isThrownBy {
93
+ assertThatExceptionOfType(NoSuchElementException ::class .java).isThrownBy {
92
94
runBlocking { find.awaitOne() }
93
95
}
94
96
@@ -104,7 +106,7 @@ class ReactiveSelectOperationExtensionsUnitTests {
104
106
every { find.one() } returns Mono .just(" foo" )
105
107
106
108
runBlocking {
107
- Assertions . assertThat(find.awaitOneOrNull()).isEqualTo(" foo" )
109
+ assertThat(find.awaitOneOrNull()).isEqualTo(" foo" )
108
110
}
109
111
110
112
verify {
@@ -119,7 +121,7 @@ class ReactiveSelectOperationExtensionsUnitTests {
119
121
every { find.one() } returns Mono .empty()
120
122
121
123
runBlocking {
122
- Assertions . assertThat(find.awaitOneOrNull()).isNull()
124
+ assertThat(find.awaitOneOrNull()).isNull()
123
125
}
124
126
125
127
verify {
@@ -134,7 +136,7 @@ class ReactiveSelectOperationExtensionsUnitTests {
134
136
every { find.first() } returns Mono .just(" foo" )
135
137
136
138
runBlocking {
137
- Assertions . assertThat(find.awaitFirst()).isEqualTo(" foo" )
139
+ assertThat(find.awaitFirst()).isEqualTo(" foo" )
138
140
}
139
141
140
142
verify {
@@ -148,7 +150,7 @@ class ReactiveSelectOperationExtensionsUnitTests {
148
150
val find = mockk<ReactiveSelectOperation .TerminatingSelect <String >>()
149
151
every { find.first() } returns Mono .empty()
150
152
151
- Assertions . assertThatExceptionOfType(NoSuchElementException ::class .java).isThrownBy {
153
+ assertThatExceptionOfType(NoSuchElementException ::class .java).isThrownBy {
152
154
runBlocking { find.awaitFirst() }
153
155
}
154
156
@@ -164,7 +166,7 @@ class ReactiveSelectOperationExtensionsUnitTests {
164
166
every { find.first() } returns Mono .just(" foo" )
165
167
166
168
runBlocking {
167
- Assertions . assertThat(find.awaitFirstOrNull()).isEqualTo(" foo" )
169
+ assertThat(find.awaitFirstOrNull()).isEqualTo(" foo" )
168
170
}
169
171
170
172
verify {
@@ -179,7 +181,7 @@ class ReactiveSelectOperationExtensionsUnitTests {
179
181
every { find.first() } returns Mono .empty()
180
182
181
183
runBlocking {
182
- Assertions . assertThat(find.awaitFirstOrNull()).isNull()
184
+ assertThat(find.awaitFirstOrNull()).isNull()
183
185
}
184
186
185
187
verify {
@@ -194,7 +196,7 @@ class ReactiveSelectOperationExtensionsUnitTests {
194
196
every { find.count() } returns Mono .just(1 )
195
197
196
198
runBlocking {
197
- Assertions . assertThat(find.awaitCount()).isEqualTo(1 )
199
+ assertThat(find.awaitCount()).isEqualTo(1 )
198
200
}
199
201
200
202
verify {
@@ -209,23 +211,23 @@ class ReactiveSelectOperationExtensionsUnitTests {
209
211
every { find.exists() } returns Mono .just(true )
210
212
211
213
runBlocking {
212
- Assertions . assertThat(find.awaitExists()).isTrue()
214
+ assertThat(find.awaitExists()).isTrue()
213
215
}
214
216
215
217
verify {
216
218
find.exists()
217
219
}
218
220
}
219
221
220
- @Test
222
+ @Test // DATACASS-648
221
223
@FlowPreview
222
224
fun terminatingFindAllAsFlow () {
223
225
224
226
val spec = mockk<ReactiveSelectOperation .TerminatingSelect <String >>()
225
227
every { spec.all() } returns Flux .just(" foo" , " bar" , " baz" )
226
228
227
229
runBlocking {
228
- Assertions . assertThat(spec.allAsFlow ().toList()).contains(" foo" , " bar" , " baz" )
230
+ assertThat(spec.flow ().toList()).contains(" foo" , " bar" , " baz" )
229
231
}
230
232
231
233
verify {
0 commit comments