File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
src/test/groovy/ru/mystamps/web/service Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -656,6 +656,42 @@ class SeriesServiceImplTest extends Specification {
656
656
}) >> 0L
657
657
}
658
658
659
+ //
660
+ // Tests for countStampsOf()
661
+ //
662
+
663
+ def " countStampsOf() should throw exception when collection is null" () {
664
+ when :
665
+ service. countStampsOf(null )
666
+ then :
667
+ thrown IllegalArgumentException
668
+ }
669
+
670
+ def " countStampsOf() should throw exception when collection id is null" () {
671
+ given :
672
+ Collection collection = Mock ()
673
+ collection. getId() >> null
674
+ when :
675
+ service. countStampsOf(collection)
676
+ then :
677
+ thrown IllegalArgumentException
678
+ }
679
+
680
+ def " countStampsOf() should pass arguments to dao" () {
681
+ given :
682
+ Integer expectedCollectionId = 8
683
+ and :
684
+ Collection expectedCollection = Mock ()
685
+ expectedCollection. getId() >> expectedCollectionId
686
+ when :
687
+ service. countStampsOf(expectedCollection)
688
+ then :
689
+ 1 * jdbcSeriesDao. countStampsOfCollection({ Integer collectionId ->
690
+ assert expectedCollectionId == collectionId
691
+ return true
692
+ }) >> 0L
693
+ }
694
+
659
695
//
660
696
// Tests for countByMichelNumber()
661
697
//
You can’t perform that action at this time.
0 commit comments