Skip to content

Commit cd9f824

Browse files
committed
improve(series import): detect Michel numbers when they are prefixed with "Michel".
Fix #1311
1 parent ec58996 commit cd9f824

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class SeriesInfoExtractorServiceImpl implements SeriesInfoExtractorServic
6767

6868
// Regular expression matches range of Michel catalog numbers (from 1 to 9999).
6969
private static final Pattern MICHEL_NUMBERS_REGEXP =
70-
Pattern.compile("#[ ]?(?<begin>[1-9][0-9]{0,3})-(?<end>[1-9][0-9]{0,3})");
70+
Pattern.compile("(#|Michel)[ ]?(?<begin>[1-9][0-9]{0,3})-(?<end>[1-9][0-9]{0,3})");
7171

7272
// Regular expression matches prices that have a space between digits.
7373
private static final Pattern PRICE_WITH_SPACES = Pattern.compile("([0-9]) ([0-9])");

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

+7-6
Original file line numberDiff line numberDiff line change
@@ -472,14 +472,15 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
472472
expect:
473473
service.extractMichelNumbers(fragment) == expected
474474
where:
475-
fragment || expected
475+
fragment || expected
476476
// negative cases
477-
nullOrBlank() || []
478-
'#9999-9997' || []
479-
'#0997-0999' || []
477+
nullOrBlank() || []
478+
'#9999-9997' || []
479+
'#0997-0999' || []
480480
// positive cases
481-
'# 1-3' || [ '1', '2', '3' ]
482-
'#9997-9999' || [ '9997', '9998', '9999' ]
481+
'# 1-3' || [ '1', '2', '3' ]
482+
'#9997-9999' || [ '9997', '9998', '9999' ]
483+
'Michel 222-223' || [ '222', '223' ]
483484
}
484485

485486
//

0 commit comments

Comments
 (0)