mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-22279 Fix invalid new Locale in testing
This commit is contained in:
parent
57e4b0cd17
commit
a36619060c
9 changed files with 22 additions and 22 deletions
|
@ -1582,7 +1582,7 @@ public class CollationAPITest extends TestFmwk {
|
|||
*/
|
||||
try {
|
||||
TestCreateCollator tcc = new TestCreateCollator();
|
||||
tcc.createCollator(new Locale("en_US"));
|
||||
tcc.createCollator(new Locale("en", "US"));
|
||||
} catch (Exception e) {
|
||||
errln("Collator.createCollator(Locale) was not suppose to " + "return an exception.");
|
||||
}
|
||||
|
@ -1602,7 +1602,7 @@ public class CollationAPITest extends TestFmwk {
|
|||
*/
|
||||
try {
|
||||
TestCreateCollator tcc = new TestCreateCollator();
|
||||
tcc.getDisplayName(new Locale("en_US"), new Locale("jp_JP"));
|
||||
tcc.getDisplayName(new Locale("en", "US"), new Locale("jp", "JP"));
|
||||
} catch (Exception e) {
|
||||
errln("Collator.getDisplayName(Locale,Locale) was not suppose to return an exception.");
|
||||
}
|
||||
|
|
|
@ -1263,7 +1263,7 @@ public class CollationMiscTest extends TestFmwk {
|
|||
|
||||
// no such locale in icu4j
|
||||
// logln("Using ko__LOTUS locale\n");
|
||||
// genericLocaleStarter(new Locale("ko__LOTUS", ""), koreanData);
|
||||
// genericLocaleStarter(new Locale("ko", "", "LOTUS"), koreanData);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -285,7 +285,7 @@ public class JapaneseTest extends CalendarTestFmwk {
|
|||
SimpleDateFormat fmt = (SimpleDateFormat)c.getDateTimeFormat(1,1,new ULocale("en_US@calendar=japanese"));
|
||||
fmt.applyPattern("G y");
|
||||
logln("fmt's locale = " + fmt.getLocale(ULocale.ACTUAL_LOCALE));
|
||||
//SimpleDateFormat fmt = new SimpleDateFormat("G y", new Locale("en_US@calendar=japanese"));
|
||||
//SimpleDateFormat fmt = new SimpleDateFormat("G y", new ULocale("en_US@calendar=japanese"));
|
||||
long aDateLong = -3197117222000L; // 1868-09-08 00:00 Pacific Time (GMT-07:52:58)
|
||||
if (TimeZone.getDefaultTimeZoneType() == TimeZone.TIMEZONE_JDK) {
|
||||
// Java time zone implementation does not support LMTs
|
||||
|
|
|
@ -399,7 +399,7 @@ public class CompactDecimalFormatTest extends TestFmwk {
|
|||
@Test
|
||||
public void TestArabicLongStyle() {
|
||||
NumberFormat cdf =
|
||||
CompactDecimalFormat.getInstance(new Locale("ar-EG"), CompactStyle.LONG);
|
||||
CompactDecimalFormat.getInstance(new Locale("ar", "EG"), CompactStyle.LONG);
|
||||
assertEquals("Arabic Long", "\u061C-\u0665\u066B\u0663 \u0623\u0644\u0641", cdf.format(-5300));
|
||||
}
|
||||
|
||||
|
|
|
@ -1273,7 +1273,7 @@ public class DateFormatRegressionTest extends TestFmwk {
|
|||
@Test
|
||||
public void TestT10110() {
|
||||
try {
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("Gy年M月d日E", new Locale("zh_Hans"));
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("Gy年M月d日E", Locale.forLanguageTag("zh-Hans"));
|
||||
/* Object parsed = */ formatter.parseObject("610000");
|
||||
}
|
||||
catch(ParseException pe) {
|
||||
|
|
|
@ -2465,13 +2465,13 @@ public class DateFormatTest extends TestFmwk {
|
|||
sym.equals(null);
|
||||
|
||||
sym = new ChineseDateFormatSymbols();
|
||||
sym = new ChineseDateFormatSymbols(new Locale("en_US"));
|
||||
sym = new ChineseDateFormatSymbols(new Locale("en", "US"));
|
||||
try{
|
||||
sym = new ChineseDateFormatSymbols(null, new Locale("en_US"));
|
||||
sym = new ChineseDateFormatSymbols(null, new Locale("en", "US"));
|
||||
errln("ChineseDateFormatSymbols(Calender, Locale) was suppose to return a null " +
|
||||
"pointer exception for a null paramater.");
|
||||
} catch(Exception e){}
|
||||
sym = new ChineseDateFormatSymbols(new ChineseCalendar(), new Locale("en_US"));
|
||||
sym = new ChineseDateFormatSymbols(new ChineseCalendar(), new Locale("en", "US"));
|
||||
try{
|
||||
sym = new ChineseDateFormatSymbols(null, new ULocale("en_US"));
|
||||
errln("ChineseDateFormatSymbols(Calender, ULocale) was suppose to return a null " +
|
||||
|
@ -4011,8 +4011,8 @@ public class DateFormatTest extends TestFmwk {
|
|||
try{
|
||||
@SuppressWarnings("unused")
|
||||
DateFormat df = DateFormat.getPatternInstance("");
|
||||
df = DateFormat.getPatternInstance("", new Locale("en_US"));
|
||||
df = DateFormat.getPatternInstance(null, "", new Locale("en_US"));
|
||||
df = DateFormat.getPatternInstance("", new Locale("en", "US"));
|
||||
df = DateFormat.getPatternInstance(null, "", new Locale("en", "US"));
|
||||
} catch(Exception e) {
|
||||
errln("DateFormat.getPatternInstance is not suppose to return an exception, got: " + e.toString());
|
||||
//e.printStackTrace();
|
||||
|
|
|
@ -2241,13 +2241,13 @@ public class DateIntervalFormatTest extends TestFmwk {
|
|||
public void testTicket20707() {
|
||||
TimeZone tz = TimeZone.getTimeZone("UTC");
|
||||
Locale locales[] = {
|
||||
new Locale("en-u-hc-h24"),
|
||||
new Locale("en-u-hc-h23"),
|
||||
new Locale("en-u-hc-h12"),
|
||||
new Locale("en-u-hc-h11"),
|
||||
new Locale("en"),
|
||||
new Locale("en-u-hc-h25"),
|
||||
new Locale("hi-IN-u-hc-h11")
|
||||
Locale.forLanguageTag("en-u-hc-h24"),
|
||||
Locale.forLanguageTag("en-u-hc-h23"),
|
||||
Locale.forLanguageTag("en-u-hc-h12"),
|
||||
Locale.forLanguageTag("en-u-hc-h11"),
|
||||
Locale.forLanguageTag("en"),
|
||||
Locale.forLanguageTag("en-u-hc-h25"),
|
||||
Locale.forLanguageTag("hi-IN-u-hc-h11")
|
||||
};
|
||||
|
||||
// Clomuns: hh, HH, kk, KK, jj, JJs, CC
|
||||
|
|
|
@ -115,7 +115,7 @@ public class TimeUnitTest extends TestFmwk {
|
|||
format.setLocale(es);
|
||||
formatParsing(format);
|
||||
|
||||
format.setLocale(new Locale("pt_BR"));
|
||||
format.setLocale(new Locale("pt", "BR"));
|
||||
formatParsing(format);
|
||||
format = new TimeUnitFormat(new Locale("de"));
|
||||
formatParsing(format);
|
||||
|
@ -343,7 +343,7 @@ public class TimeUnitTest extends TestFmwk {
|
|||
}
|
||||
for (int i = 0; i < cases.length; i++) {
|
||||
try {
|
||||
TimeUnitFormat tuf = new TimeUnitFormat(new Locale("en_US"), cases[i]);
|
||||
TimeUnitFormat tuf = new TimeUnitFormat(new Locale("en", "US"), cases[i]);
|
||||
errln("TimeUnitFormat(ULocale,int) was suppose to return an " + "exception for a style value of "
|
||||
+ cases[i] + "passed into the constructor.");
|
||||
} catch (Exception e) {
|
||||
|
@ -358,7 +358,7 @@ public class TimeUnitTest extends TestFmwk {
|
|||
public void TestSetLocale() {
|
||||
// Tests when "if ( locale != this.locale )" is false
|
||||
TimeUnitFormat tuf = new TimeUnitFormat(new ULocale("en_US"));
|
||||
if (!tuf.setLocale(new ULocale("en_US")).equals(tuf) && !tuf.setLocale(new Locale("en_US")).equals(tuf)) {
|
||||
if (!tuf.setLocale(new ULocale("en_US")).equals(tuf) && !tuf.setLocale(new Locale("en", "US")).equals(tuf)) {
|
||||
errln("TimeUnitFormat.setLocale(ULocale) was suppose to "
|
||||
+ "return the same TimeUnitFormat object if the same " + "ULocale is entered as a parameter.");
|
||||
}
|
||||
|
|
|
@ -1743,7 +1743,7 @@ public class FormatHandler
|
|||
{
|
||||
CurrencyPluralInfo currencyPluralInfo[] = {
|
||||
new CurrencyPluralInfo(), new CurrencyPluralInfo(new ULocale("en_US")),
|
||||
CurrencyPluralInfo.getInstance(), CurrencyPluralInfo.getInstance(new Locale("en_US")),
|
||||
CurrencyPluralInfo.getInstance(), CurrencyPluralInfo.getInstance(new Locale("en", "US")),
|
||||
CurrencyPluralInfo.getInstance(new ULocale("en_US"))
|
||||
};
|
||||
for(int i=0; i<currencyPluralInfo.length; i++){
|
||||
|
|
Loading…
Add table
Reference in a new issue