File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
src/test/groovy/ru/mystamps/web/service Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -864,4 +864,48 @@ class SeriesServiceImplTest extends Specification {
864
864
result == expectedResult
865
865
}
866
866
867
+ //
868
+ // Tests for findBy(Collection)
869
+ //
870
+
871
+ def " findBy(Collection) should throw exception when collection is null" () {
872
+ when :
873
+ service. findBy(null as Collection , ' whatever' )
874
+ then :
875
+ thrown IllegalArgumentException
876
+ }
877
+
878
+ def " findBy(Collection) should throw exception when collection id is null" () {
879
+ given :
880
+ Collection collection = Mock ()
881
+ collection. getId() >> null
882
+ when :
883
+ service. findBy(collection, ' whatever' )
884
+ then :
885
+ thrown IllegalArgumentException
886
+ }
887
+
888
+ def " findBy(Collection) should pass arguments to dao" () {
889
+ given :
890
+ Integer expectedCollectionId = 16
891
+ and :
892
+ String expectedLang = ' expected'
893
+ and :
894
+ Collection expectedCollection = Mock ()
895
+ expectedCollection. getId() >> expectedCollectionId
896
+ when :
897
+ service. findBy(expectedCollection, expectedLang)
898
+ then :
899
+ 1 * seriesDao. findByAsSeriesInfo(
900
+ { Integer collectionId ->
901
+ assert expectedCollectionId == collectionId
902
+ return true
903
+ },
904
+ { String lang ->
905
+ assert expectedLang == lang
906
+ return true
907
+ }
908
+ ) >> []
909
+ }
910
+
867
911
}
You can’t perform that action at this time.
0 commit comments