Skip to content

Commit bc3504e

Browse files
committed
refactor(SeriesInfoExtractorServiceImplTest): use Random.issueYear().
1 parent 3901f45 commit bc3504e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ import ru.mystamps.web.feature.series.SeriesValidation
2828
import spock.lang.Specification
2929
import spock.lang.Unroll
3030

31-
import java.time.Year
32-
3331
import static io.qala.datagen.RandomElements.from
3432
import static io.qala.datagen.RandomShortApi.nullOrBlank
3533
import static io.qala.datagen.RandomValue.between
@@ -301,10 +299,9 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
301299
@SuppressWarnings('UnnecessaryGetter')
302300
def 'extractIssueDate() should return the first year if there are many'() {
303301
given:
304-
Integer currentYear = Year.now().getValue()
305-
Integer expectedYear = between(SeriesValidation.MIN_RELEASE_YEAR, currentYear).integer()
302+
Integer expectedYear = Random.issueYear()
306303
and:
307-
Integer anotherYear = between(SeriesValidation.MIN_RELEASE_YEAR, currentYear).integer()
304+
Integer anotherYear = Random.issueYear()
308305
and:
309306
String fragment = String.format('%d %d', expectedYear, anotherYear)
310307
when:
@@ -320,8 +317,7 @@ class SeriesInfoExtractorServiceImplTest extends Specification {
320317
Integer unsupportedYearInFuture = between(MAX_SUPPORTED_RELEASE_YEAR + 1, Integer.MAX_VALUE).integer()
321318
Integer unsupportedYear = from(unsupportedYearInPast, unsupportedYearInFuture).sample()
322319
and:
323-
Integer currentYear = Year.now().getValue()
324-
Integer expectedYear = between(SeriesValidation.MIN_RELEASE_YEAR, currentYear).integer()
320+
Integer expectedYear = Random.issueYear()
325321
and:
326322
String fragment = String.format('%d %d', unsupportedYear, expectedYear)
327323
when:

0 commit comments

Comments
 (0)