|
|
|
@ -618,51 +618,50 @@ public class StringUtilsTests {
@@ -618,51 +618,50 @@ public class StringUtilsTests {
|
|
|
|
|
assertNull("When given an empty Locale string, must return null.", locale); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// SPR-8637
|
|
|
|
|
@Test |
|
|
|
|
@Test // SPR-8637
|
|
|
|
|
public void testParseLocaleWithMultiSpecialCharactersInVariant() throws Exception { |
|
|
|
|
final String variant = "proper-northern"; |
|
|
|
|
final String localeString = "en_GB_" + variant; |
|
|
|
|
String variant = "proper-northern"; |
|
|
|
|
String localeString = "en_GB_" + variant; |
|
|
|
|
Locale locale = StringUtils.parseLocaleString(localeString); |
|
|
|
|
assertEquals("Multi-valued variant portion of the Locale not extracted correctly.", variant, locale.getVariant()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // SPR-3671
|
|
|
|
|
public void testParseLocaleWithMultiValuedVariant() throws Exception { |
|
|
|
|
final String variant = "proper_northern"; |
|
|
|
|
final String localeString = "en_GB_" + variant; |
|
|
|
|
String variant = "proper_northern"; |
|
|
|
|
String localeString = "en_GB_" + variant; |
|
|
|
|
Locale locale = StringUtils.parseLocaleString(localeString); |
|
|
|
|
assertEquals("Multi-valued variant portion of the Locale not extracted correctly.", variant, locale.getVariant()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // SPR-3671
|
|
|
|
|
public void testParseLocaleWithMultiValuedVariantUsingSpacesAsSeparators() throws Exception { |
|
|
|
|
final String variant = "proper northern"; |
|
|
|
|
final String localeString = "en GB " + variant; |
|
|
|
|
String variant = "proper northern"; |
|
|
|
|
String localeString = "en GB " + variant; |
|
|
|
|
Locale locale = StringUtils.parseLocaleString(localeString); |
|
|
|
|
assertEquals("Multi-valued variant portion of the Locale not extracted correctly.", variant, locale.getVariant()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // SPR-3671
|
|
|
|
|
public void testParseLocaleWithMultiValuedVariantUsingMixtureOfUnderscoresAndSpacesAsSeparators() throws Exception { |
|
|
|
|
final String variant = "proper northern"; |
|
|
|
|
final String localeString = "en_GB_" + variant; |
|
|
|
|
String variant = "proper northern"; |
|
|
|
|
String localeString = "en_GB_" + variant; |
|
|
|
|
Locale locale = StringUtils.parseLocaleString(localeString); |
|
|
|
|
assertEquals("Multi-valued variant portion of the Locale not extracted correctly.", variant, locale.getVariant()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // SPR-3671
|
|
|
|
|
public void testParseLocaleWithMultiValuedVariantUsingSpacesAsSeparatorsWithLotsOfLeadingWhitespace() throws Exception { |
|
|
|
|
final String variant = "proper northern"; |
|
|
|
|
final String localeString = "en GB " + variant; // lots of whitespace
|
|
|
|
|
String variant = "proper northern"; |
|
|
|
|
String localeString = "en GB " + variant; // lots of whitespace
|
|
|
|
|
Locale locale = StringUtils.parseLocaleString(localeString); |
|
|
|
|
assertEquals("Multi-valued variant portion of the Locale not extracted correctly.", variant, locale.getVariant()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // SPR-3671
|
|
|
|
|
public void testParseLocaleWithMultiValuedVariantUsingUnderscoresAsSeparatorsWithLotsOfLeadingWhitespace() throws Exception { |
|
|
|
|
final String variant = "proper_northern"; |
|
|
|
|
final String localeString = "en_GB_____" + variant; // lots of underscores
|
|
|
|
|
String variant = "proper_northern"; |
|
|
|
|
String localeString = "en_GB_____" + variant; // lots of underscores
|
|
|
|
|
Locale locale = StringUtils.parseLocaleString(localeString); |
|
|
|
|
assertEquals("Multi-valued variant portion of the Locale not extracted correctly.", variant, locale.getVariant()); |
|
|
|
|
} |
|
|
|
|