Skip to content

Commit bc12ccf

Browse files
committed
fix(tests): always and explicitly specify locale to toLowerCase() method.
See https://garygregory.wordpress.com/2015/11/03/java-lowercase-conversion-turkey/
1 parent eb4e7e4 commit bc12ccf

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/test/groovy/ru/mystamps/web/feature/category/CategoryServiceImplTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class CategoryServiceImplTest extends Specification {
205205

206206
def 'findIdsWhenNameStartsWith() should invoke dao, pass argument and return result from dao'() {
207207
given:
208-
String name = between(1, 10).english().toLowerCase()
208+
String name = between(1, 10).english().toLowerCase(Locale.ENGLISH)
209209
String expectedPattern = name + '%'
210210
and:
211211
List<Integer> expectedResult = Random.listOfIntegers()

src/test/groovy/ru/mystamps/web/feature/country/CountryServiceImplTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class CountryServiceImplTest extends Specification {
204204

205205
def 'findIdsWhenNameStartsWith() should invoke dao, pass argument and return result from dao'() {
206206
given:
207-
String name = between(1, 10).english().toLowerCase()
207+
String name = between(1, 10).english().toLowerCase(Locale.ENGLISH)
208208
String expectedPattern = name + '%'
209209
and:
210210
List<Integer> expectedResult = Random.listOfIntegers()

src/test/groovy/ru/mystamps/web/feature/image/FilesystemImagePersistenceStrategyTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class FilesystemImagePersistenceStrategyTest extends Specification {
6666
@SuppressWarnings(['ClosureAsLastMethodParameter', 'UnnecessaryReturnKeyword'])
6767
def 'save() should give a proper name to a file'() {
6868
given:
69-
String expectedExtension = imageInfoDto.type.toLowerCase()
69+
String expectedExtension = imageInfoDto.type.toLowerCase(Locale.ENGLISH)
7070
String expectedName = imageInfoDto.id
7171
String expectedFileName = expectedName + '.' + expectedExtension
7272
when:

src/test/java/ru/mystamps/web/feature/series/importing/extractor/JsoupSiteParserTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.junit.Test;
2626
import org.junit.rules.ExpectedException;
2727
import ru.mystamps.web.tests.Random;
28+
import java.util.Locale;
2829

2930
import static io.qala.datagen.RandomShortApi.nullOr;
3031
import static io.qala.datagen.RandomShortApi.nullOrBlank;
@@ -66,8 +67,8 @@ public void parseShouldExtractSeriesInfo() {
6667
String expectedIssueDate = Random.issueYear().toString();
6768
String imageUrl = String.format(
6869
"/%s-%s-%s.png",
69-
expectedCountry.toLowerCase(),
70-
expectedCategory.toLowerCase(),
70+
expectedCountry.toLowerCase(Locale.ENGLISH),
71+
expectedCategory.toLowerCase(Locale.ENGLISH),
7172
expectedIssueDate
7273
);
7374
String expectedImageUrl = baseUri + imageUrl;
@@ -128,8 +129,8 @@ public void parseShouldExtractSeriesInfoFromFirstMatchedElements() {
128129
String expectedIssueDate = Random.issueYear().toString();
129130
String imageUrl = String.format(
130131
"/%s-%s-%s.png",
131-
expectedCountry.toLowerCase(),
132-
expectedCategory.toLowerCase(),
132+
expectedCountry.toLowerCase(Locale.ENGLISH),
133+
expectedCategory.toLowerCase(Locale.ENGLISH),
133134
expectedIssueDate
134135
);
135136
String sellerUrl = String.format("/seller/%d/info.htm", positiveInteger());

0 commit comments

Comments
 (0)