File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
src/test/groovy/ru/mystamps/web/service Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -811,6 +811,37 @@ class SeriesServiceImplTest extends Specification {
811
811
result == expectedResult
812
812
}
813
813
814
+ //
815
+ // Tests for findSeriesIdByGibbonsNumber()
816
+ //
817
+
818
+ @Unroll
819
+ def " findSeriesIdByGibbonsNumber() should throw exception for invalid argument '#gibbonsNumberCode'" (String gibbonsNumberCode) {
820
+ when :
821
+ service. findSeriesIdByGibbonsNumber(gibbonsNumberCode)
822
+ then :
823
+ thrown IllegalArgumentException
824
+ where :
825
+ gibbonsNumberCode | _
826
+ null | _
827
+ ' ' | _
828
+ ' ' | _
829
+ }
830
+
831
+ def " findSeriesIdByGibbonsNumber() should pass argument to dao and return result" () {
832
+ given :
833
+ Optional<Integer > expectedResult = Optional . of(1 );
834
+ when :
835
+ Optional<Integer > result = service. findSeriesIdByGibbonsNumber(' 5' );
836
+ then :
837
+ 1 * jdbcSeriesDao. findSeriesIdByGibbonsNumberCode({ String code ->
838
+ assert code == ' 5'
839
+ return true
840
+ }) >> expectedResult
841
+ and :
842
+ result == expectedResult
843
+ }
844
+
814
845
//
815
846
// Tests for findByCategoryId()
816
847
//
You can’t perform that action at this time.
0 commit comments