From 615bf48660f598877b5f42dbb638445f9a98551d Mon Sep 17 00:00:00 2001 From: Yoshito Umaoka Date: Thu, 26 Oct 2006 17:28:54 +0000 Subject: [PATCH] ICU-5480 added a test case for getEquivalentID problem reported by JB#5480 in TestEquivalencyGroups X-SVN-Rev: 20599 --- .../icu/dev/test/timezone/TimeZoneTest.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/icu4j/src/com/ibm/icu/dev/test/timezone/TimeZoneTest.java b/icu4j/src/com/ibm/icu/dev/test/timezone/TimeZoneTest.java index 1b2cd548e9b..27fe378ed04 100755 --- a/icu4j/src/com/ibm/icu/dev/test/timezone/TimeZoneTest.java +++ b/icu4j/src/com/ibm/icu/dev/test/timezone/TimeZoneTest.java @@ -831,6 +831,26 @@ public class TimeZoneTest extends TestFmwk logln("" + i + ":" + s); } } + + // JB#5480 - equivalent IDs should not be empty within range + String[] ids = TimeZone.getAvailableIDs(); + for (int i = 0; i < ids.length; i++) { + int nEquiv = TimeZone.countEquivalentIDs(ids[i]); + // Each equivalent ID must not be empty + for (int j = 0; j < nEquiv; j++) { + String equivID = TimeZone.getEquivalentID(ids[i], j); + if (equivID.length() == 0) { + errln("FAIL: getEquivalentID(" + ids[i] + ", " + i + + ") returned \"" + equivID + "\", expected valid ID"); + } + } + // equivalent ID out of range must be empty + String outOfRangeID = TimeZone.getEquivalentID(ids[i], nEquiv); + if (outOfRangeID.length() != 0) { + errln("FAIL: getEquivalentID(" + ids[i] + ", " + i + + ") returned \"" + outOfRangeID + "\", expected empty string"); + } + } } public void TestCountries() {