@Test
 public void testParseLocaleStringSunnyDay() throws Exception {
   Locale expectedLocale = Locale.UK;
   Locale locale = StringUtils.parseLocaleString(expectedLocale.toString());
   assertNotNull("When given a bona-fide Locale string, must not return null.", locale);
   assertEquals(expectedLocale, locale);
 }
 // SPR-11806
 @Test
 public void testParseLocaleWithVariantContainingCountryCode() {
   String variant = "GBtest";
   String localeString = "en_GB_" + variant;
   Locale locale = StringUtils.parseLocaleString(localeString);
   assertEquals(
       "Variant containing country code not extracted correctly", variant, locale.getVariant());
 }
 // SPR-7779
 @Test
 public void testParseLocaleWithInvalidCharacters() {
   try {
     StringUtils.parseLocaleString(
         "%0D%0AContent-length:30%0D%0A%0D%0A%3Cscript%3Ealert%28123%29%3C/script%3E");
     fail("Should have thrown IllegalArgumentException");
   } catch (IllegalArgumentException ex) {
     // expected
   }
 }
 // SPR-3671
 @Test
 public void testParseLocaleWithMultiValuedVariantUsingSpacesAsSeparators() throws Exception {
   final String variant = "proper northern";
   final String localeString = "en GB " + variant;
   Locale locale = StringUtils.parseLocaleString(localeString);
   assertEquals(
       "Multi-valued variant portion of the Locale not extracted correctly.",
       variant,
       locale.getVariant());
 }
 // SPR-8637
 @Test
 public void testParseLocaleWithMultiSpecialCharactersInVariant() throws Exception {
   final String variant = "proper-northern";
   final String localeString = "en_GB_" + variant;
   Locale locale = StringUtils.parseLocaleString(localeString);
   assertEquals(
       "Multi-valued variant portion of the Locale not extracted correctly.",
       variant,
       locale.getVariant());
 }
 // SPR-3671
 @Test
 public void
     testParseLocaleWithMultiValuedVariantUsingUnderscoresAsSeparatorsWithLotsOfLeadingWhitespace()
         throws Exception {
   final String variant = "proper_northern";
   final 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());
 }
 // SPR-9420
 @Test
 public void testParseLocaleWithSameLowercaseTokenForLanguageAndCountry() {
   assertEquals("tr_TR", StringUtils.parseLocaleString("tr_tr").toString());
   assertEquals("bg_BG_vnt", StringUtils.parseLocaleString("bg_bg_vnt").toString());
 }
 @Test
 public void testParseLocaleStringWithEmptyLocaleStringYieldsNullLocale() throws Exception {
   Locale locale = StringUtils.parseLocaleString("");
   assertNull("When given an empty Locale string, must return null.", locale);
 }
 @Test
 public void testParseLocaleStringWithMalformedLocaleString() throws Exception {
   Locale locale = StringUtils.parseLocaleString("_banjo_on_my_knee");
   assertNotNull("When given a malformed Locale string, must not return null.", locale);
 }