File tree 2 files changed +28
-1
lines changed
main/java/ru/mystamps/web/service
test/groovy/ru/mystamps/web/service
2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,6 @@ protected Integer extractReleaseYear(String fragment) {
198
198
return null ;
199
199
}
200
200
201
- // @todo #781 SeriesInfoExtractorServiceImpl.extractQuantity(): add unit tests
202
201
// @todo #781 SeriesInfoExtractorServiceImpl.extractQuantity() respect MAX_STAMPS_IN_SERIES
203
202
protected Integer extractQuantity (String fragment ) {
204
203
if (StringUtils .isBlank (fragment )) {
Original file line number Diff line number Diff line change @@ -309,6 +309,34 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
309
309
' part of word2000' | _
310
310
}
311
311
312
+ //
313
+ // Tests for extractQuantity()
314
+ //
315
+
316
+ def ' extractQuantity() should return null when fragment is null, empty or blank' () {
317
+ expect :
318
+ service. extractQuantity(nullOrBlank()) == null
319
+ }
320
+
321
+ def ' extractQuantity() should return null for invalid price' () {
322
+ expect :
323
+ service. extractQuantity(' 0 марок' ) == null
324
+ }
325
+
326
+ @Unroll
327
+ def ' extractQuantity() should extract quantity from "#fragment"' (String fragment, Integer expectedQuantity) {
328
+ expect :
329
+ service. extractQuantity(fragment) == expectedQuantity
330
+ where :
331
+ fragment || expectedQuantity
332
+ ' 5 марок' || 5
333
+ ' 5 МАРОК' || 5
334
+ ' 22 марки' || 22
335
+ ' 13 беззубцовые марок' || 13
336
+ ' 4 беззубцовые марки' || 4
337
+ ' 32 БЕЗЗУБЦОВЫЕ МАРКИ' || 32
338
+ }
339
+
312
340
//
313
341
// Tests for extractSeller()
314
342
//
You can’t perform that action at this time.
0 commit comments