File tree 1 file changed +32
-0
lines changed
src/test/groovy/ru/mystamps/web/service 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -127,4 +127,36 @@ class DatabaseImagePersistenceStrategyTest extends Specification {
127
127
result == expectedImageDto
128
128
}
129
129
130
+ //
131
+ // Tests for getPreview()
132
+ //
133
+
134
+ def ' getPreview() should return null when image data dao returned null' () {
135
+ given :
136
+ imageDataDao. findByImageId(_ as Integer , _ as Boolean ) >> null
137
+ when :
138
+ ImageDto result = strategy. getPreview(imageInfoDto)
139
+ then :
140
+ result == null
141
+ }
142
+
143
+ def ' getPreview() should return result of image data dao' () {
144
+ given :
145
+ Integer expectedImageId = imageInfoDto. id
146
+ and :
147
+ ImageDto expectedImageDto = TestObjects . createDbImageDto()
148
+ when :
149
+ ImageDto result = strategy. getPreview(imageInfoDto)
150
+ then :
151
+ 1 * imageDataDao. findByImageId({ Integer imageId ->
152
+ assert imageId == expectedImageId
153
+ return true
154
+ }, { Boolean preview ->
155
+ assert preview == true
156
+ return true
157
+ }) >> expectedImageDto
158
+ and :
159
+ result == expectedImageDto
160
+ }
161
+
130
162
}
You can’t perform that action at this time.
0 commit comments