ICU-11912 Adding test coverage for TimeZoneNames.getAvailableMetaZoneIDs()
X-SVN-Rev: 39012
This commit is contained in:
parent
32f80a647b
commit
e8c36f0d04
@ -530,9 +530,9 @@ public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
};
|
||||
boolean isExcluded = false;
|
||||
for (Object[] excl : EXCLUSIONS) {
|
||||
if (excl[0] == null || loc.equals((ULocale)excl[0])) {
|
||||
if (excl[0] == null || loc.equals(excl[0])) {
|
||||
if (id.equals(excl[1])) {
|
||||
if (excl[2] == null || pattern.equals((String)excl[2])) {
|
||||
if (excl[2] == null || pattern.equals(excl[2])) {
|
||||
if (excl[3] == null || ((Long)excl[3]).compareTo(time) == 0) {
|
||||
isExcluded = true;
|
||||
break;
|
||||
@ -944,7 +944,7 @@ public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
TimeZoneFormat tzfmt = TimeZoneFormat.getInstance(uloc);
|
||||
String out = tzfmt.format((Style)testCase[3], tz, ((Date)testCase[2]).getTime(), timeType);
|
||||
|
||||
if (!out.equals((String)testCase[4]) || timeType.value != testCase[5]) {
|
||||
if (!out.equals(testCase[4]) || timeType.value != testCase[5]) {
|
||||
errln("Format result for [locale=" + testCase[0] + ",tzid=" + testCase[1] + ",date=" + testCase[2]
|
||||
+ ",style=" + testCase[3] + "]: expected [output=" + testCase[4] + ",type=" + testCase[5]
|
||||
+ "]; actual [output=" + out + ",type=" + timeType.value + "]");
|
||||
@ -955,7 +955,7 @@ public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
tzfmt = TimeZoneFormat.getInstance(loc);
|
||||
out = tzfmt.format((Style)testCase[3], tz, ((Date)testCase[2]).getTime(), timeType);
|
||||
|
||||
if (!out.equals((String)testCase[4]) || timeType.value != testCase[5]) {
|
||||
if (!out.equals(testCase[4]) || timeType.value != testCase[5]) {
|
||||
errln("Format result for [locale(Java)=" + testCase[0] + ",tzid=" + testCase[1] + ",date=" + testCase[2]
|
||||
+ ",style=" + testCase[3] + "]: expected [output=" + testCase[4] + ",type=" + testCase[5]
|
||||
+ "]; actual [output=" + out + ",type=" + timeType.value + "]");
|
||||
@ -1037,7 +1037,7 @@ public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
Output<TimeType> timeType = new Output<TimeType>();
|
||||
String out = tzfmt.format((Style)testCase[3], tz, ((Date)testCase[2]).getTime(), timeType);
|
||||
|
||||
if (!out.equals((String)testCase[4]) || timeType.value != testCase[5]) {
|
||||
if (!out.equals(testCase[4]) || timeType.value != testCase[5]) {
|
||||
errln("Format result for [locale=" + testCase[0] + ",tzid=" + testCase[1] + ",date=" + testCase[2]
|
||||
+ ",style=" + testCase[3] + "]: expected [output=" + testCase[4] + ",type=" + testCase[5]
|
||||
+ "]; actual [output=" + out + ",type=" + timeType.value + "]");
|
||||
@ -1120,9 +1120,11 @@ public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
}
|
||||
|
||||
// Basic get/set test for methods not being called otherwise.
|
||||
@Test
|
||||
public void TestAPI() {
|
||||
TimeZoneFormat tzfmtEn = TimeZoneFormat.getInstance(ULocale.ENGLISH);
|
||||
TimeZoneFormat tzfmtAr = TimeZoneFormat.getInstance(new ULocale("ar")).cloneAsThawed();
|
||||
TimeZoneNames tzn = TimeZoneNames.getInstance(ULocale.ENGLISH);
|
||||
|
||||
String digits = tzfmtEn.getGMTOffsetDigits();
|
||||
tzfmtAr.setGMTOffsetDigits(digits);
|
||||
@ -1141,5 +1143,15 @@ public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
if (!zeroFmt.equals(tzfmtAr.getGMTZeroFormat())) {
|
||||
errln("ERROR: get/set GMTZeroFormat failed");
|
||||
}
|
||||
|
||||
Set<String> allAvailableMZIDs = tzn.getAvailableMetaZoneIDs();
|
||||
if (allAvailableMZIDs.size() < 150 || !allAvailableMZIDs.contains("America_Central")) {
|
||||
errln("ERROR: getAvailableMetaZoneIDs() did not return expected value");
|
||||
}
|
||||
|
||||
Set<String> kinshasaAvailableMZIDs = tzn.getAvailableMetaZoneIDs("Africa/Kinshasa");
|
||||
if (!kinshasaAvailableMZIDs.contains("Africa_Western") || kinshasaAvailableMZIDs.contains("America_Central")) {
|
||||
errln("ERROR: getAvailableMetaZoneIDs('Africa/Kinshasa') did not return expected value");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user