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