35
35
import java .time .Duration ;
36
36
import java .util .ArrayList ;
37
37
import java .util .Arrays ;
38
+ import java .util .LinkedList ;
38
39
import java .util .List ;
39
40
import java .util .Locale ;
40
41
import java .util .Optional ;
@@ -237,6 +238,30 @@ void findByInjection() {
237
238
238
239
}
239
240
241
+ @ Test
242
+ void issue1304CollectionParameter () {
243
+ Airport vie = null ;
244
+ try {
245
+ vie = new Airport ("airports::vie" , "vie" , "low5" );
246
+ airportRepository .save (vie );
247
+ java .util .Collection <String > iatas = new LinkedList <String >();
248
+ iatas .add (vie .getIata ());
249
+ java .util .Collection <String > icaos = new LinkedList <String >();
250
+ icaos .add (vie .getIcao ());
251
+ icaos .add ("blue" );
252
+ PageRequest pageable = PageRequest .of ( 0 , 1 , Sort .by ("iata" ));
253
+ List <Airport >airports = airportRepository .findByIataInAndIcaoIn (iatas , icaos , pageable );
254
+ assertEquals (1 , airports .size ());
255
+
256
+ List <Airport >airports2 = airportRepository .findByIataInAndIcaoIn (iatas , icaos , pageable );
257
+ assertEquals (1 , airports2 .size ());
258
+
259
+ } finally {
260
+ airportRepository .delete (vie );
261
+ }
262
+
263
+ }
264
+
240
265
@ Test
241
266
void findBySimpleProperty () {
242
267
Airport vie = null ;
@@ -369,9 +394,11 @@ void findByTypeAlias() {
369
394
@ Test
370
395
void findByEnum () {
371
396
Airport vie = null ;
397
+ Airport zzz = null ;
372
398
try {
373
399
vie = new Airport ("airports::vie" , "vie" , "loww" );
374
400
vie = airportRepository .save (vie );
401
+ zzz = airportRepository .save (vie .withId ("airports::zzz" ).withIata ("zzz" ));
375
402
Airport airport2 = airportRepository .findByIata (Iata .vie );
376
403
assertNotNull (airport2 , "should have found " + vie );
377
404
assertEquals (airport2 .getId (), vie .getId ());
@@ -386,8 +413,19 @@ void findByEnum() {
386
413
assertNotNull (airport4 , "should have found " + vie );
387
414
assertEquals (airport4 .getId (), vie .getId ());
388
415
416
+ Airport airport5 = airportRepository .findByIataIn (Iata .vie , Iata .xxx );
417
+ assertNotNull (airport5 , "should have found " + vie );
418
+ assertEquals (airport5 .getId (), vie .getId ());
419
+
420
+ JsonArray iatasJson = JsonArray .ja ();
421
+ iatasJson .add (Iata .vie .toString ());
422
+ iatasJson .add (Iata .xxx .toString ());
423
+ Airport airport6 = airportRepository .findByIataIn (iatasJson );
424
+ assertNotNull (airport6 , "should have found " + vie );
425
+ assertEquals (airport6 .getId (), vie .getId ());
389
426
} finally {
390
427
airportRepository .delete (vie );
428
+ airportRepository .delete (zzz );
391
429
}
392
430
}
393
431
0 commit comments