@@ -24,7 +24,7 @@ import ru.mystamps.web.feature.country.CountryService
24
24
import ru.mystamps.web.feature.country.CountryValidation
25
25
import ru.mystamps.web.feature.participant.ParticipantService
26
26
import ru.mystamps.web.tests.Random
27
- import ru.mystamps.web.validation.ValidationRules
27
+ import ru.mystamps.web.feature.series.SeriesValidation
28
28
import spock.lang.Specification
29
29
import spock.lang.Unroll
30
30
@@ -34,7 +34,6 @@ import static io.qala.datagen.RandomElements.from
34
34
import static io.qala.datagen.RandomShortApi.nullOrBlank
35
35
import static io.qala.datagen.RandomValue.between
36
36
import static ru.mystamps.web.feature.series.importing.SeriesInfoExtractorServiceImpl.MAX_SUPPORTED_RELEASE_YEAR
37
- import static ru.mystamps.web.validation.ValidationRules.MAX_STAMPS_IN_SERIES
38
37
39
38
@SuppressWarnings ([
40
39
' ClassJavadoc' ,
@@ -245,7 +244,7 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
245
244
246
245
def ' extractReleaseYear() should extract year from XIX century' () {
247
246
given :
248
- Integer expectedYear = between(ValidationRules . MIN_RELEASE_YEAR , 1899 ). integer()
247
+ Integer expectedYear = between(SeriesValidation . MIN_RELEASE_YEAR , 1899 ). integer()
249
248
and :
250
249
String fragment = String . valueOf(expectedYear)
251
250
when :
@@ -300,9 +299,9 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
300
299
def ' extractReleaseYear() should return the first year if there are many' () {
301
300
given :
302
301
Integer currentYear = Year . now(). getValue()
303
- Integer expectedYear = between(ValidationRules . MIN_RELEASE_YEAR , currentYear). integer()
302
+ Integer expectedYear = between(SeriesValidation . MIN_RELEASE_YEAR , currentYear). integer()
304
303
and :
305
- Integer anotherYear = between(ValidationRules . MIN_RELEASE_YEAR , currentYear). integer()
304
+ Integer anotherYear = between(SeriesValidation . MIN_RELEASE_YEAR , currentYear). integer()
306
305
and :
307
306
String fragment = String . format(' %d %d' , expectedYear, anotherYear)
308
307
when :
@@ -314,12 +313,12 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
314
313
@SuppressWarnings (' UnnecessaryGetter' )
315
314
def ' extractReleaseYear() should skip invalid date' () {
316
315
given :
317
- Integer unsupportedYearInPast = between(0 , ValidationRules . MIN_RELEASE_YEAR - 1 ). integer()
316
+ Integer unsupportedYearInPast = between(0 , SeriesValidation . MIN_RELEASE_YEAR - 1 ). integer()
318
317
Integer unsupportedYearInFuture = between(MAX_SUPPORTED_RELEASE_YEAR + 1 , Integer . MAX_VALUE ). integer()
319
318
Integer unsupportedYear = from(unsupportedYearInPast, unsupportedYearInFuture). sample()
320
319
and :
321
320
Integer currentYear = Year . now(). getValue()
322
- Integer expectedYear = between(ValidationRules . MIN_RELEASE_YEAR , currentYear). integer()
321
+ Integer expectedYear = between(SeriesValidation . MIN_RELEASE_YEAR , currentYear). integer()
323
322
and :
324
323
String fragment = String . format(' %d %d' , unsupportedYear, expectedYear)
325
324
when :
@@ -330,7 +329,7 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
330
329
331
330
def ' extractReleaseYear() shouldn\' t extract dates before 1840' () {
332
331
given :
333
- Integer unsupportedYear = between(0 , ValidationRules . MIN_RELEASE_YEAR - 1 ). integer()
332
+ Integer unsupportedYear = between(0 , SeriesValidation . MIN_RELEASE_YEAR - 1 ). integer()
334
333
String fragment = String . valueOf(unsupportedYear)
335
334
when :
336
335
Integer year = service. extractReleaseYear(fragment)
@@ -377,9 +376,9 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
377
376
expect :
378
377
service. extractQuantity(fragment) == null
379
378
where :
380
- fragment | _
381
- ' 0 марок' | _
382
- (MAX_STAMPS_IN_SERIES + 1 ) + ' марок' | _
379
+ fragment | _
380
+ ' 0 марок' | _
381
+ (SeriesValidation . MAX_STAMPS_IN_SERIES + 1 ) + ' марок' | _
383
382
}
384
383
385
384
@Unroll
0 commit comments