Commit 32448360 authored by Phillip Webb's avatar Phillip Webb

Port Locale sensitive test from 1.5.x

parent fdf42ab9
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
package org.springframework.boot.convert; package org.springframework.boot.convert;
import java.util.Locale;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
...@@ -78,6 +80,21 @@ public class StringToEnumIgnoringCaseConverterFactoryTests { ...@@ -78,6 +80,21 @@ public class StringToEnumIgnoringCaseConverterFactoryTests {
.isEqualTo(TestEnum.THREE_AND_FOUR); .isEqualTo(TestEnum.THREE_AND_FOUR);
} }
@Test
public void convertFromStringToEnumWhenUsingNonEnglishLocaleShouldConvertValue() {
Locale defaultLocale = Locale.getDefault();
try {
Locale.setDefault(new Locale("tr"));
LocaleSensitiveEnum result = this.conversionService.convert(
"accept-case-insensitive-properties", LocaleSensitiveEnum.class);
assertThat(result
.equals(LocaleSensitiveEnum.ACCEPT_CASE_INSENSITIVE_PROPERTIES));
}
finally {
Locale.setDefault(defaultLocale);
}
}
@Parameters(name = "{0}") @Parameters(name = "{0}")
public static Iterable<Object[]> conversionServices() { public static Iterable<Object[]> conversionServices() {
return new ConversionServiceParameters( return new ConversionServiceParameters(
...@@ -90,6 +107,12 @@ public class StringToEnumIgnoringCaseConverterFactoryTests { ...@@ -90,6 +107,12 @@ public class StringToEnumIgnoringCaseConverterFactoryTests {
} }
enum LocaleSensitiveEnum {
ACCEPT_CASE_INSENSITIVE_PROPERTIES
}
enum TestSubclassEnum { enum TestSubclassEnum {
ONE { ONE {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment