Skip to content

Commit 98f58ca

Browse files
committed
Reset default local after test completes
1 parent 8f9c067 commit 98f58ca

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

spring-boot/src/test/java/org/springframework/boot/bind/RelaxedConversionServiceTests.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,16 @@ public class RelaxedConversionServiceTests {
3636

3737
@Test
3838
public void conversionServiceShouldAlwaysUseLocaleEnglish() {
39-
Locale.setDefault(new Locale("tr"));
40-
TestEnum result = this.conversionService
41-
.convert("accept-case-insensitive-properties", TestEnum.class);
42-
assertThat(result.equals(TestEnum.ACCEPT_CASE_INSENSITIVE_PROPERTIES));
39+
Locale defaultLocale = Locale.getDefault();
40+
try {
41+
Locale.setDefault(new Locale("tr"));
42+
TestEnum result = this.conversionService
43+
.convert("accept-case-insensitive-properties", TestEnum.class);
44+
assertThat(result.equals(TestEnum.ACCEPT_CASE_INSENSITIVE_PROPERTIES));
45+
}
46+
finally {
47+
Locale.setDefault(defaultLocale);
48+
}
4349
}
4450

4551
enum TestEnum {

0 commit comments

Comments
 (0)