File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
main/java/ru/mystamps/web/service
test/groovy/ru/mystamps/web/service Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,6 @@ protected Integer extractReleaseYear(String fragment) {
227
227
return null ;
228
228
}
229
229
230
- // @todo #781 SeriesInfoExtractorServiceImpl.extractQuantity() respect MAX_STAMPS_IN_SERIES
231
230
protected Integer extractQuantity (String fragment ) {
232
231
if (StringUtils .isBlank (fragment )) {
233
232
return null ;
@@ -237,9 +236,11 @@ protected Integer extractQuantity(String fragment) {
237
236
238
237
Matcher matcher = NUMBER_OF_STAMPS_REGEXP .matcher (fragment );
239
238
if (matcher .find ()) {
240
- String quantity = matcher .group ("quantity" );
241
- log .debug ("Quantity is {}" , quantity );
242
- return Integer .valueOf (quantity );
239
+ Integer quantity = Integer .valueOf (matcher .group ("quantity" ));
240
+ if (quantity <= ValidationRules .MAX_STAMPS_IN_SERIES ) {
241
+ log .debug ("Quantity is {}" , quantity );
242
+ return quantity ;
243
+ }
243
244
}
244
245
245
246
log .debug ("Could not extract quantity from a fragment" );
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import static io.qala.datagen.RandomShortApi.nullOrBlank
22
22
import static io.qala.datagen.RandomValue.between
23
23
24
24
import static ru.mystamps.web.service.SeriesInfoExtractorServiceImpl.MAX_SUPPORTED_RELEASE_YEAR
25
+ import static ru.mystamps.web.validation.ValidationRules.MAX_STAMPS_IN_SERIES
25
26
26
27
import java.time.Year
27
28
@@ -334,8 +335,9 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
334
335
expect :
335
336
service. extractQuantity(fragment) == null
336
337
where :
337
- fragment | _
338
- ' 0 марок' | _
338
+ fragment | _
339
+ ' 0 марок' | _
340
+ (MAX_STAMPS_IN_SERIES + 1 ) + ' марок' | _
339
341
}
340
342
341
343
@Unroll
You can’t perform that action at this time.
0 commit comments