Skip to content

Commit 7b1efcb

Browse files
committed
chore: correct the regexp for extracting quantity to unbreak integration tests.
It started to extract quantity from numbers that don't followed by a special words.
1 parent 11d5806 commit 7b1efcb

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/main/java/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class SeriesInfoExtractorServiceImpl implements SeriesInfoExtractorServic
6161
// Regular expression matches number of the stamps in a series (from 1 to 999).
6262
// CheckStyle: ignore LineLength for next 2 lines
6363
private static final Pattern NUMBER_OF_STAMPS_REGEXP = Pattern.compile(
64-
"(?<quantity>[1-9][0-9]{0,2})(-?(ти|ой|ух))?( ((без)?зубцов(ая|ы[ех])))?(м\\*{0,2}|( (мар(ок|к[аи])|блок(а|ов)?|БЛ)?))",
64+
"(?<quantity>[1-9][0-9]{0,2})(-?(ти|ой|ух))?( ((без)?зубцов(ая|ы[ех])))?(м\\*{0,2}| (мар(ок|к[аи])|блок(а|ов)?|БЛ))",
6565
Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE
6666
);
6767

src/test/groovy/ru/mystamps/web/feature/series/importing/SeriesInfoExtractorServiceImplTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
391391
service.extractQuantity(fragment) == null
392392
where:
393393
fragment | _
394+
'2 чего-либо' | _
394395
'0 марок' | _
395396
(SeriesValidation.MAX_STAMPS_IN_SERIES + 1) + ' марок' | _
396397
}

0 commit comments

Comments
 (0)