File tree 2 files changed +35
-1
lines changed
main/java/ru/mystamps/web/service
test/groovy/ru/mystamps/web/service
2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -240,7 +240,6 @@ protected Boolean extractPerforated(String fragment) {
240
240
return null ;
241
241
}
242
242
243
- // @todo #695 SeriesInfoExtractorServiceImpl.extractSeller(): add unit tests
244
243
public Integer extractSeller (String name , String url ) {
245
244
if (StringUtils .isBlank (name ) || StringUtils .isBlank (url )) {
246
245
return null ;
Original file line number Diff line number Diff line change @@ -308,6 +308,41 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
308
308
' test/2000' | _
309
309
' part of word2000' | _
310
310
}
311
+
312
+ //
313
+ // Tests for extractSeller()
314
+ //
315
+
316
+ def ' extractSeller() should return null when name is null, empty or blank' () {
317
+ when :
318
+ String result = service. extractSeller(nullOrBlank(), Random . url())
319
+ then :
320
+ result == null
321
+ }
322
+
323
+ def ' extractSeller() should return null when url is null, empty or blank' () {
324
+ when :
325
+ String result = service. extractSeller(Random . sellerName(), nullOrBlank())
326
+ then :
327
+ result == null
328
+ }
329
+
330
+ @Unroll
331
+ def ' extractSeller() should invoke dao and return its result (#expectedResult)' (Integer expectedResult) {
332
+ given :
333
+ String expectedName = Random . sellerName()
334
+ String expectedUrl = Random . url()
335
+ when :
336
+ Integer result = service. extractSeller(expectedName, expectedUrl)
337
+ then :
338
+ 1 * transactionParticipantService. findSellerId(expectedName, expectedUrl) >> expectedResult
339
+ and :
340
+ result == expectedResult
341
+ where :
342
+ expectedResult | _
343
+ null | _
344
+ Random . id() | _
345
+ }
311
346
312
347
//
313
348
// Tests for extractPrice()
You can’t perform that action at this time.
0 commit comments