Skip to content

Commit 6c30fc8

Browse files
committed
SeriesServiceImplTest: propagate Random.lang().
Addressed to #300 No functional changes.
1 parent 6e038f6 commit 6c30fc8

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

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

+21-21
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ class SeriesServiceImplTest extends Specification {
700700

701701
def "findFullInfoById() should return null when series not found"() {
702702
when:
703-
SeriesDto result = service.findFullInfoById(Random.id(), 'de')
703+
SeriesDto result = service.findFullInfoById(Random.id(), Random.lang())
704704
then:
705705
1 * seriesDao.findByIdAsSeriesFullInfo(_ as Integer, _ as String)
706706
and:
@@ -717,7 +717,7 @@ class SeriesServiceImplTest extends Specification {
717717
def "findFullInfoById() should return info about series"() {
718718
given:
719719
Integer expectedSeriesId = Random.id()
720-
String expectedLang = 'kz'
720+
String expectedLang = Random.lang()
721721
SeriesFullInfoDto expectedInfo = TestObjects.createSeriesFullInfoDto()
722722
List<String> expectedMichelNumbers = [ '1', '2' ]
723723
List<String> expectedScottNumbers = [ '3', '4' ]
@@ -792,7 +792,7 @@ class SeriesServiceImplTest extends Specification {
792792
given:
793793
String expectedNumber = Random.catalogNumber()
794794
when:
795-
service.findByMichelNumber(expectedNumber, 'en')
795+
service.findByMichelNumber(expectedNumber, Random.lang())
796796
then:
797797
1 * michelCatalogService.findSeriesIdsByNumber(expectedNumber) >> []
798798
}
@@ -801,7 +801,7 @@ class SeriesServiceImplTest extends Specification {
801801
given:
802802
michelCatalogService.findSeriesIdsByNumber(_ as String) >> []
803803
when:
804-
List<SeriesInfoDto> result = service.findByMichelNumber(Random.catalogNumber(), 'en')
804+
List<SeriesInfoDto> result = service.findByMichelNumber(Random.catalogNumber(), Random.lang())
805805
then:
806806
0 * seriesDao.findByIdsAsSeriesInfo(_ as List, _ as String)
807807
and:
@@ -810,7 +810,7 @@ class SeriesServiceImplTest extends Specification {
810810

811811
def "findByMichelNumber() should find and return series info"() {
812812
given:
813-
String expectedLang = 'en'
813+
String expectedLang = Random.lang()
814814
and:
815815
List<Integer> expectedSeriesIds = [ 1 ]
816816
and:
@@ -833,7 +833,7 @@ class SeriesServiceImplTest extends Specification {
833833
given:
834834
String expectedNumber = Random.catalogNumber()
835835
when:
836-
service.findByScottNumber(expectedNumber, 'en')
836+
service.findByScottNumber(expectedNumber, Random.lang())
837837
then:
838838
1 * scottCatalogService.findSeriesIdsByNumber(expectedNumber) >> []
839839
}
@@ -842,7 +842,7 @@ class SeriesServiceImplTest extends Specification {
842842
given:
843843
scottCatalogService.findSeriesIdsByNumber(_ as String) >> []
844844
when:
845-
List<SeriesInfoDto> result = service.findByScottNumber(Random.catalogNumber(), 'en')
845+
List<SeriesInfoDto> result = service.findByScottNumber(Random.catalogNumber(), Random.lang())
846846
then:
847847
0 * seriesDao.findByIdsAsSeriesInfo(_ as List, _ as String)
848848
and:
@@ -851,7 +851,7 @@ class SeriesServiceImplTest extends Specification {
851851

852852
def "findByScottNumber() should find and return series info"() {
853853
given:
854-
String expectedLang = 'en'
854+
String expectedLang = Random.lang()
855855
and:
856856
List<Integer> expectedSeriesIds = [ 1 ]
857857
and:
@@ -874,7 +874,7 @@ class SeriesServiceImplTest extends Specification {
874874
given:
875875
String expectedNumber = Random.catalogNumber()
876876
when:
877-
service.findByYvertNumber(expectedNumber, 'en')
877+
service.findByYvertNumber(expectedNumber, Random.lang())
878878
then:
879879
1 * yvertCatalogService.findSeriesIdsByNumber(expectedNumber) >> []
880880
}
@@ -883,7 +883,7 @@ class SeriesServiceImplTest extends Specification {
883883
given:
884884
yvertCatalogService.findSeriesIdsByNumber(_ as String) >> []
885885
when:
886-
List<SeriesInfoDto> result = service.findByYvertNumber(Random.catalogNumber(), 'en')
886+
List<SeriesInfoDto> result = service.findByYvertNumber(Random.catalogNumber(), Random.lang())
887887
then:
888888
0 * seriesDao.findByIdsAsSeriesInfo(_ as List, _ as String)
889889
and:
@@ -892,7 +892,7 @@ class SeriesServiceImplTest extends Specification {
892892

893893
def "findByYvertNumber() should find and return series info"() {
894894
given:
895-
String expectedLang = 'en'
895+
String expectedLang = Random.lang()
896896
and:
897897
List<Integer> expectedSeriesIds = [ 1 ]
898898
and:
@@ -915,7 +915,7 @@ class SeriesServiceImplTest extends Specification {
915915
given:
916916
String expectedNumber = Random.catalogNumber()
917917
when:
918-
service.findByGibbonsNumber(expectedNumber, 'en')
918+
service.findByGibbonsNumber(expectedNumber, Random.lang())
919919
then:
920920
1 * gibbonsCatalogService.findSeriesIdsByNumber(expectedNumber) >> []
921921
}
@@ -924,7 +924,7 @@ class SeriesServiceImplTest extends Specification {
924924
given:
925925
gibbonsCatalogService.findSeriesIdsByNumber(_ as String) >> []
926926
when:
927-
List<SeriesInfoDto> result = service.findByGibbonsNumber(Random.catalogNumber(), 'en')
927+
List<SeriesInfoDto> result = service.findByGibbonsNumber(Random.catalogNumber(), Random.lang())
928928
then:
929929
0 * seriesDao.findByIdsAsSeriesInfo(_ as List, _ as String)
930930
and:
@@ -933,7 +933,7 @@ class SeriesServiceImplTest extends Specification {
933933

934934
def "findByGibbonsNumber() should find and return series info"() {
935935
given:
936-
String expectedLang = 'en'
936+
String expectedLang = Random.lang()
937937
and:
938938
List<Integer> expectedSeriesIds = [ 1 ]
939939
and:
@@ -1032,7 +1032,7 @@ class SeriesServiceImplTest extends Specification {
10321032

10331033
def "findByCategorySlug() should throw exception if category slug is null"() {
10341034
when:
1035-
service.findByCategorySlug(null, 'any')
1035+
service.findByCategorySlug(null, Random.lang())
10361036
then:
10371037
thrown IllegalArgumentException
10381038
}
@@ -1045,7 +1045,7 @@ class SeriesServiceImplTest extends Specification {
10451045
and:
10461046
seriesDao.findByCategorySlugAsSeriesInfo(_ as String, _ as String) >> expectedResult
10471047
when:
1048-
List<SeriesInfoDto> result = service.findByCategorySlug('iceland', 'any')
1048+
List<SeriesInfoDto> result = service.findByCategorySlug('iceland', Random.lang())
10491049
then:
10501050
result == expectedResult
10511051
}
@@ -1056,7 +1056,7 @@ class SeriesServiceImplTest extends Specification {
10561056

10571057
def "findByCountrySlug() should throw exception if country slug is null"() {
10581058
when:
1059-
service.findByCountrySlug(null, 'any')
1059+
service.findByCountrySlug(null, Random.lang())
10601060
then:
10611061
thrown IllegalArgumentException
10621062
}
@@ -1069,7 +1069,7 @@ class SeriesServiceImplTest extends Specification {
10691069
and:
10701070
seriesDao.findByCountrySlugAsSeriesInfo(_ as String, _ as String) >> expectedResult
10711071
when:
1072-
List<SeriesInfoDto> result = service.findByCountrySlug('germany', 'any')
1072+
List<SeriesInfoDto> result = service.findByCountrySlug('germany', Random.lang())
10731073
then:
10741074
result == expectedResult
10751075
}
@@ -1080,7 +1080,7 @@ class SeriesServiceImplTest extends Specification {
10801080

10811081
def "findByCollectionId() should throw exception when collection id is null"() {
10821082
when:
1083-
service.findByCollectionId(null, 'whatever')
1083+
service.findByCollectionId(null, Random.lang())
10841084
then:
10851085
thrown IllegalArgumentException
10861086
}
@@ -1089,7 +1089,7 @@ class SeriesServiceImplTest extends Specification {
10891089
given:
10901090
Integer expectedCollectionId = Random.id()
10911091
and:
1092-
String expectedLang = 'expected'
1092+
String expectedLang = Random.lang()
10931093
when:
10941094
service.findByCollectionId(expectedCollectionId, expectedLang)
10951095
then:
@@ -1116,7 +1116,7 @@ class SeriesServiceImplTest extends Specification {
11161116
given:
11171117
int expectedQuantity = 3
11181118
and:
1119-
String expectedLang = 'expected'
1119+
String expectedLang = Random.lang()
11201120
when:
11211121
service.findRecentlyAdded(expectedQuantity, expectedLang)
11221122
then:

0 commit comments

Comments
 (0)