Skip to content

Commit d628e80

Browse files
committed
SeriesInfoExtractorServiceImpl.extractPerforated(): add unit tests.
Fix #794
1 parent 2eaf81b commit d628e80

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/main/java/ru/mystamps/web/service/SeriesInfoExtractorServiceImpl.java

-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ protected Integer extractQuantity(String fragment) {
218218
return null;
219219
}
220220

221-
// @todo #782 SeriesInfoExtractorServiceImpl.extractPerforated(): add unit tests
222221
// @todo #782 Series import: add integration test for extracting perforation flag
223222
protected Boolean extractPerforated(String fragment) {
224223
if (StringUtils.isBlank(fragment)) {

src/test/groovy/ru/mystamps/web/service/SeriesInfoExtractorServiceImplTest.groovy

+26
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,32 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
337337
'4 беззубцовые марки' || 4
338338
'32 БЕЗЗУБЦОВЫЕ МАРКИ' || 32
339339
}
340+
341+
//
342+
// Tests for extractPerforated()
343+
//
344+
345+
def 'extractPerforated() should return null when fragment is null, empty or blank'() {
346+
expect:
347+
service.extractPerforated(nullOrBlank()) == null
348+
}
349+
350+
def 'extractPerforated() should return null when nothing to extract'() {
351+
expect:
352+
service.extractPerforated('10 марок') == null
353+
}
354+
355+
@Unroll
356+
def 'extractPerforated() should extract perforated from "#fragment"'(String fragment) {
357+
expect:
358+
service.extractPerforated(fragment) == false
359+
where:
360+
fragment | _
361+
'б/з' | _
362+
'Б/З' | _
363+
'беззубцовые' | _
364+
'БЕЗЗУБЦОВЫЕ' | _
365+
}
340366

341367
//
342368
// Tests for extractSeller()

0 commit comments

Comments
 (0)