@@ -379,42 +379,6 @@ class SeriesServiceImplTest extends Specification {
379
379
actual == expected
380
380
}
381
381
382
- @SuppressWarnings ([' ClosureAsLastMethodParameter' , ' UnnecessaryReturnKeyword' ])
383
- def " add() should pass image to image service" () {
384
- given :
385
- form. setImage(multipartFile)
386
- when :
387
- service. add(form, userId, false )
388
- then :
389
- 1 * imageService. save({ MultipartFile passedFile ->
390
- assert passedFile == multipartFile
391
- return true
392
- }) >> ANY_IMAGE_ID
393
- }
394
-
395
- @SuppressWarnings ([' ClosureAsLastMethodParameter' , ' UnnecessaryReturnKeyword' ])
396
- def " add() should add image to the series" () {
397
- given :
398
- Integer expectedSeriesId = 123
399
- and :
400
- seriesDao. add(_ as AddSeriesDbDto ) >> expectedSeriesId
401
- and :
402
- Integer expectedImageId = 456
403
- when :
404
- service. add(form, userId, false )
405
- then :
406
- // FIXME: why we can't use _ as MultipartFile here?
407
- imageService. save(_) >> expectedImageId
408
- and :
409
- 1 * imageService. addToSeries({ Integer seriesId ->
410
- assert seriesId == expectedSeriesId
411
- return true
412
- }, { Integer imageId ->
413
- assert imageId == expectedImageId
414
- return true
415
- })
416
- }
417
-
418
382
@Unroll
419
383
def " add() should not call services if michel numbers is '#numbers'" (String numbers) {
420
384
given :
@@ -587,6 +551,42 @@ class SeriesServiceImplTest extends Specification {
587
551
})
588
552
}
589
553
554
+ @SuppressWarnings ([' ClosureAsLastMethodParameter' , ' UnnecessaryReturnKeyword' ])
555
+ def " add() should pass image to image service" () {
556
+ given :
557
+ form. setImage(multipartFile)
558
+ when :
559
+ service. add(form, userId, false )
560
+ then :
561
+ 1 * imageService. save({ MultipartFile passedFile ->
562
+ assert passedFile == multipartFile
563
+ return true
564
+ }) >> ANY_IMAGE_ID
565
+ }
566
+
567
+ @SuppressWarnings ([' ClosureAsLastMethodParameter' , ' UnnecessaryReturnKeyword' ])
568
+ def " add() should add image to the series" () {
569
+ given :
570
+ Integer expectedSeriesId = 123
571
+ and :
572
+ seriesDao. add(_ as AddSeriesDbDto ) >> expectedSeriesId
573
+ and :
574
+ Integer expectedImageId = 456
575
+ when :
576
+ service. add(form, userId, false )
577
+ then :
578
+ // FIXME: why we can't use _ as MultipartFile here?
579
+ imageService. save(_) >> expectedImageId
580
+ and :
581
+ 1 * imageService. addToSeries({ Integer seriesId ->
582
+ assert seriesId == expectedSeriesId
583
+ return true
584
+ }, { Integer imageId ->
585
+ assert imageId == expectedImageId
586
+ return true
587
+ })
588
+ }
589
+
590
590
//
591
591
// Tests for addImageToSeries()
592
592
//
0 commit comments