1515 */
1616package org .springframework .data .r2dbc .core ;
1717
18+ import static org .assertj .core .api .Assertions .*;
19+ import static org .mockito .Mockito .*;
20+
1821import io .r2dbc .spi .R2dbcType ;
1922import io .r2dbc .spi .test .MockColumnMetadata ;
2023import io .r2dbc .spi .test .MockResult ;
2124import io .r2dbc .spi .test .MockRow ;
2225import io .r2dbc .spi .test .MockRowMetadata ;
26+ import reactor .core .publisher .Mono ;
27+ import reactor .test .StepVerifier ;
28+
29+ import java .time .LocalDateTime ;
30+ import java .util .ArrayList ;
31+ import java .util .Collections ;
32+ import java .util .List ;
33+
2334import org .junit .jupiter .api .BeforeEach ;
2435import org .junit .jupiter .api .Test ;
2536import org .springframework .beans .factory .ObjectFactory ;
4960import org .springframework .r2dbc .core .DatabaseClient ;
5061import org .springframework .r2dbc .core .Parameter ;
5162import org .springframework .util .CollectionUtils ;
52- import reactor .core .publisher .Mono ;
53- import reactor .test .StepVerifier ;
54-
55- import java .time .LocalDateTime ;
56- import java .util .ArrayList ;
57- import java .util .Collections ;
58- import java .util .List ;
59-
60- import static org .assertj .core .api .Assertions .*;
61- import static org .mockito .Mockito .*;
6263
6364/**
6465 * Unit tests for {@link R2dbcEntityTemplate}.
@@ -83,8 +84,7 @@ void before() {
8384 entityTemplate = new R2dbcEntityTemplate (client , PostgresDialect .INSTANCE );
8485 }
8586
86- @ Test
87- // gh-220
87+ @ Test // gh-220
8888 void shouldCountBy () {
8989
9090 MockRowMetadata metadata = MockRowMetadata .builder ()
@@ -104,8 +104,7 @@ void shouldCountBy() {
104104 assertThat (statement .getBindings ()).hasSize (1 ).containsEntry (0 , Parameter .from ("Walter" ));
105105 }
106106
107- @ Test
108- // gh-469
107+ @ Test // gh-469
109108 void shouldProjectExistsResult () {
110109
111110 MockRowMetadata metadata = MockRowMetadata .builder ()
@@ -122,8 +121,7 @@ void shouldProjectExistsResult() {
122121 .verifyComplete ();
123122 }
124123
125- @ Test
126- // gh-1310
124+ @ Test // gh-1310
127125 void shouldProjectExistsResultWithoutId () {
128126
129127 MockResult result = MockResult .builder ().row (MockRow .builder ().identified (0 , Object .class , null ).build ()).build ();
@@ -135,8 +133,7 @@ void shouldProjectExistsResultWithoutId() {
135133 .expectNext (true ).verifyComplete ();
136134 }
137135
138- @ Test
139- // gh-1310
136+ @ Test // gh-1310
140137 void shouldProjectCountResultWithoutId () {
141138
142139 MockResult result = MockResult .builder ().row (MockRow .builder ().identified (0 , Long .class , 1L ).build ()).build ();
@@ -148,8 +145,7 @@ void shouldProjectCountResultWithoutId() {
148145 .expectNext (1L ).verifyComplete ();
149146 }
150147
151- @ Test
152- // gh-469
148+ @ Test // gh-469
153149 void shouldExistsByCriteria () {
154150
155151 MockRowMetadata metadata = MockRowMetadata .builder ()
@@ -169,8 +165,7 @@ void shouldExistsByCriteria() {
169165 assertThat (statement .getBindings ()).hasSize (1 ).containsEntry (0 , Parameter .from ("Walter" ));
170166 }
171167
172- @ Test
173- // gh-220
168+ @ Test // gh-220
174169 void shouldSelectByCriteria () {
175170
176171 recorder .addStubbing (s -> s .startsWith ("SELECT" ), Collections .emptyList ());
@@ -186,8 +181,7 @@ void shouldSelectByCriteria() {
186181 assertThat (statement .getBindings ()).hasSize (1 ).containsEntry (0 , Parameter .from ("Walter" ));
187182 }
188183
189- @ Test
190- // gh-215
184+ @ Test // gh-215
191185 void selectShouldInvokeCallback () {
192186
193187 MockRowMetadata metadata = MockRowMetadata .builder ()
@@ -213,8 +207,7 @@ void selectShouldInvokeCallback() {
213207 assertThat (callback .getValues ()).hasSize (1 );
214208 }
215209
216- @ Test
217- // gh-220
210+ @ Test // gh-220
218211 void shouldSelectOne () {
219212
220213 recorder .addStubbing (s -> s .startsWith ("SELECT" ), Collections .emptyList ());
@@ -230,8 +223,7 @@ void shouldSelectOne() {
230223 assertThat (statement .getBindings ()).hasSize (1 ).containsEntry (0 , Parameter .from ("Walter" ));
231224 }
232225
233- @ Test
234- // gh-220, gh-758
226+ @ Test // gh-220, gh-758
235227 void shouldSelectOneDoNotOverrideExistingLimit () {
236228
237229 recorder .addStubbing (s -> s .startsWith ("SELECT" ), Collections .emptyList ());
@@ -248,8 +240,7 @@ void shouldSelectOneDoNotOverrideExistingLimit() {
248240 assertThat (statement .getBindings ()).hasSize (1 ).containsEntry (0 , Parameter .from ("Walter" ));
249241 }
250242
251- @ Test
252- // gh-220
243+ @ Test // gh-220
253244 void shouldUpdateByQuery () {
254245
255246 MockRowMetadata metadata = MockRowMetadata .builder ()
@@ -271,8 +262,7 @@ void shouldUpdateByQuery() {
271262 Parameter .from ("Walter" ));
272263 }
273264
274- @ Test
275- // gh-220
265+ @ Test // gh-220
276266 void shouldDeleteByQuery () {
277267
278268 MockRowMetadata metadata = MockRowMetadata .builder ()
@@ -292,8 +282,7 @@ void shouldDeleteByQuery() {
292282 assertThat (statement .getBindings ()).hasSize (1 ).containsEntry (0 , Parameter .from ("Walter" ));
293283 }
294284
295- @ Test
296- // gh-220
285+ @ Test // gh-220
297286 void shouldDeleteEntity () {
298287
299288 Person person = Person .empty () //
@@ -310,8 +299,7 @@ void shouldDeleteEntity() {
310299 assertThat (statement .getBindings ()).hasSize (1 ).containsEntry (0 , Parameter .from ("Walter" ));
311300 }
312301
313- @ Test
314- // gh-365
302+ @ Test // gh-365
315303 void shouldInsertVersioned () {
316304
317305 MockRowMetadata metadata = MockRowMetadata .builder ().build ();
@@ -332,8 +320,7 @@ void shouldInsertVersioned() {
332320 Parameter .from (1L ));
333321 }
334322
335- @ Test
336- // gh-557, gh-402
323+ @ Test // gh-557, gh-402
337324 void shouldSkipDefaultIdValueOnInsert () {
338325
339326 MockRowMetadata metadata = MockRowMetadata .builder ().build ();
@@ -351,8 +338,7 @@ void shouldSkipDefaultIdValueOnInsert() {
351338 assertThat (statement .getBindings ()).hasSize (1 ).containsEntry (0 , Parameter .from ("bar" ));
352339 }
353340
354- @ Test
355- // gh-557, gh-402
341+ @ Test // gh-557, gh-402
356342 void shouldSkipDefaultIdValueOnVersionedInsert () {
357343
358344 MockRowMetadata metadata = MockRowMetadata .builder ().build ();
@@ -374,8 +360,7 @@ void shouldSkipDefaultIdValueOnVersionedInsert() {
374360 Parameter .from ("bar" ));
375361 }
376362
377- @ Test
378- // gh-451
363+ @ Test // gh-451
379364 void shouldInsertCorrectlyVersionedAndAudited () {
380365
381366 MockRowMetadata metadata = MockRowMetadata .builder ().build ();
@@ -403,8 +388,7 @@ void shouldInsertCorrectlyVersionedAndAudited() {
403388 "INSERT INTO with_auditing_and_optimistic_locking (version, name, created_date, last_modified_date) VALUES ($1, $2, $3, $4)" );
404389 }
405390
406- @ Test
407- // gh-451
391+ @ Test // gh-451
408392 void shouldUpdateCorrectlyVersionedAndAudited () {
409393
410394 MockRowMetadata metadata = MockRowMetadata .builder ().build ();
@@ -433,8 +417,7 @@ void shouldUpdateCorrectlyVersionedAndAudited() {
433417 "UPDATE with_auditing_and_optimistic_locking SET version = $1, name = $2, created_date = $3, last_modified_date = $4" );
434418 }
435419
436- @ Test
437- // gh-215
420+ @ Test // gh-215
438421 void insertShouldInvokeCallback () {
439422
440423 MockRowMetadata metadata = MockRowMetadata .builder ().build ();
@@ -462,8 +445,7 @@ void insertShouldInvokeCallback() {
462445 Parameter .from ("before-save" ));
463446 }
464447
465- @ Test
466- // gh-365
448+ @ Test // gh-365
467449 void shouldUpdateVersioned () {
468450
469451 MockRowMetadata metadata = MockRowMetadata .builder ().build ();
@@ -485,8 +467,7 @@ void shouldUpdateVersioned() {
485467 Parameter .from (1L ));
486468 }
487469
488- @ Test
489- // gh-215
470+ @ Test // gh-215
490471 void updateShouldInvokeCallback () {
491472
492473 MockRowMetadata metadata = MockRowMetadata .builder ().build ();
@@ -519,8 +500,7 @@ void updateShouldInvokeCallback() {
519500 Parameter .from ("before-save" ));
520501 }
521502
522- @ Test
523- // gh-637
503+ @ Test // gh-637
524504 void insertIncludesInsertOnlyColumns () {
525505
526506 MockRowMetadata metadata = MockRowMetadata .builder ().build ();
@@ -540,8 +520,7 @@ void insertIncludesInsertOnlyColumns() {
540520 .containsEntry (1 , Parameter .from ("insert this" ));
541521 }
542522
543- @ Test
544- // gh-637
523+ @ Test // gh-637
545524 void updateExcludesInsertOnlyColumns () {
546525
547526 MockRowMetadata metadata = MockRowMetadata .builder ().build ();
0 commit comments