1
1
/*
2
- * Copyright 2002-2014 the original author or authors.
2
+ * Copyright 2002-2016 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -618,62 +618,55 @@ public void testParseLocaleStringWithEmptyLocaleStringYieldsNullLocale() throws
618
618
assertNull ("When given an empty Locale string, must return null." , locale );
619
619
}
620
620
621
- // SPR-8637
622
- @ Test
621
+ @ Test // SPR-8637
623
622
public void testParseLocaleWithMultiSpecialCharactersInVariant () throws Exception {
624
- final String variant = "proper-northern" ;
625
- final String localeString = "en_GB_" + variant ;
623
+ String variant = "proper-northern" ;
624
+ String localeString = "en_GB_" + variant ;
626
625
Locale locale = StringUtils .parseLocaleString (localeString );
627
626
assertEquals ("Multi-valued variant portion of the Locale not extracted correctly." , variant , locale .getVariant ());
628
627
}
629
628
630
- // SPR-3671
631
- @ Test
629
+ @ Test // SPR-3671
632
630
public void testParseLocaleWithMultiValuedVariant () throws Exception {
633
- final String variant = "proper_northern" ;
634
- final String localeString = "en_GB_" + variant ;
631
+ String variant = "proper_northern" ;
632
+ String localeString = "en_GB_" + variant ;
635
633
Locale locale = StringUtils .parseLocaleString (localeString );
636
634
assertEquals ("Multi-valued variant portion of the Locale not extracted correctly." , variant , locale .getVariant ());
637
635
}
638
636
639
- // SPR-3671
640
- @ Test
637
+ @ Test // SPR-3671
641
638
public void testParseLocaleWithMultiValuedVariantUsingSpacesAsSeparators () throws Exception {
642
- final String variant = "proper northern" ;
643
- final String localeString = "en GB " + variant ;
639
+ String variant = "proper northern" ;
640
+ String localeString = "en GB " + variant ;
644
641
Locale locale = StringUtils .parseLocaleString (localeString );
645
642
assertEquals ("Multi-valued variant portion of the Locale not extracted correctly." , variant , locale .getVariant ());
646
643
}
647
644
648
- // SPR-3671
649
- @ Test
645
+ @ Test // SPR-3671
650
646
public void testParseLocaleWithMultiValuedVariantUsingMixtureOfUnderscoresAndSpacesAsSeparators () throws Exception {
651
- final String variant = "proper northern" ;
652
- final String localeString = "en_GB_" + variant ;
647
+ String variant = "proper northern" ;
648
+ String localeString = "en_GB_" + variant ;
653
649
Locale locale = StringUtils .parseLocaleString (localeString );
654
650
assertEquals ("Multi-valued variant portion of the Locale not extracted correctly." , variant , locale .getVariant ());
655
651
}
656
652
657
- // SPR-3671
658
- @ Test
653
+ @ Test // SPR-3671
659
654
public void testParseLocaleWithMultiValuedVariantUsingSpacesAsSeparatorsWithLotsOfLeadingWhitespace () throws Exception {
660
- final String variant = "proper northern" ;
661
- final String localeString = "en GB " + variant ; // lots of whitespace
655
+ String variant = "proper northern" ;
656
+ String localeString = "en GB " + variant ; // lots of whitespace
662
657
Locale locale = StringUtils .parseLocaleString (localeString );
663
658
assertEquals ("Multi-valued variant portion of the Locale not extracted correctly." , variant , locale .getVariant ());
664
659
}
665
660
666
- // SPR-3671
667
- @ Test
661
+ @ Test // SPR-3671
668
662
public void testParseLocaleWithMultiValuedVariantUsingUnderscoresAsSeparatorsWithLotsOfLeadingWhitespace () throws Exception {
669
- final String variant = "proper_northern" ;
670
- final String localeString = "en_GB_____" + variant ; // lots of underscores
663
+ String variant = "proper_northern" ;
664
+ String localeString = "en_GB_____" + variant ; // lots of underscores
671
665
Locale locale = StringUtils .parseLocaleString (localeString );
672
666
assertEquals ("Multi-valued variant portion of the Locale not extracted correctly." , variant , locale .getVariant ());
673
667
}
674
668
675
- // SPR-7779
676
- @ Test
669
+ @ Test // SPR-7779
677
670
public void testParseLocaleWithInvalidCharacters () {
678
671
try {
679
672
StringUtils .parseLocaleString ("%0D%0AContent-length:30%0D%0A%0D%0A%3Cscript%3Ealert%28123%29%3C/script%3E" );
@@ -684,20 +677,23 @@ public void testParseLocaleWithInvalidCharacters() {
684
677
}
685
678
}
686
679
687
- // SPR-9420
688
- @ Test
680
+ @ Test // SPR-9420
689
681
public void testParseLocaleWithSameLowercaseTokenForLanguageAndCountry () {
690
682
assertEquals ("tr_TR" , StringUtils .parseLocaleString ("tr_tr" ).toString ());
691
683
assertEquals ("bg_BG_vnt" , StringUtils .parseLocaleString ("bg_bg_vnt" ).toString ());
692
684
}
693
685
694
- // SPR-11806
695
- @ Test
686
+ @ Test // SPR-11806
696
687
public void testParseLocaleWithVariantContainingCountryCode () {
697
688
String variant = "GBtest" ;
698
689
String localeString = "en_GB_" + variant ;
699
690
Locale locale = StringUtils .parseLocaleString (localeString );
700
691
assertEquals ("Variant containing country code not extracted correctly" , variant , locale .getVariant ());
701
692
}
702
693
694
+ @ Test // SPR-14718
695
+ public void testParseJava7Variant () {
696
+ assertEquals ("sr_#LATN" , StringUtils .parseLocaleString ("sr_#LATN" ).toString ());
697
+ }
698
+
703
699
}
0 commit comments