{"L", "en", "K", "tz", "usnyc", "R", "US", "T", "en-us-u-tz-usnyc", "en_US@timezone=america/new_york"},
{"L", "de", "K", "co", "phonebk", "K", "ks", "level1", "K", "kk", "true", "T", "de-u-co-phonebk-kk-true-ks-level1", "de@collation=phonebook;colnormalization=yes;colstrength=primary"},
// {"L", "en", "V", "foooo_barrr", "T", "en-foooo-barrr", "en__FOOOO_BARRR"},
};
Builder bld = new Builder();
for (int tidx = 0; tidx < TESTCASE.length; tidx++) {
bld.clear();
int i = 0;
String[] expected = null;
while (true) {
String method = TESTCASE[tidx][i++];
try {
if (method.equals("L")) {
bld.setLanguage(TESTCASE[tidx][i++]);
} else if (method.equals("S")) {
bld.setScript(TESTCASE[tidx][i++]);
} else if (method.equals("R")) {
bld.setRegion(TESTCASE[tidx][i++]);
} else if (method.equals("V")) {
bld.setVariant(TESTCASE[tidx][i++]);
} else if (method.equals("K")) {
String key = TESTCASE[tidx][i++];
String type = TESTCASE[tidx][i++];
bld.setLDMLExtensionValue(key, type);
} else if (method.equals("E")) {
String key = TESTCASE[tidx][i++];
String value = TESTCASE[tidx][i++];
bld.setExtension(key.charAt(0), value);
} else if (method.equals("P")) {
bld.setExtension(ULocale.PRIVATE_USE_EXTENSION, TESTCASE[tidx][i++]);
} else if (method.equals("X")) {
errln("FAIL: No excetion was thrown - test csae: "
+ Utility.arrayToString(TESTCASE[tidx]));
} else if (method.equals("T")) {
expected = new String[2];
expected[0] = TESTCASE[tidx][i];
expected[1] = TESTCASE[tidx][i + 1];
break;
}
} catch (IllformedLocaleException e) {
if (TESTCASE[tidx][i].equals("X")) {
// This exception is expected
break;
} else {
errln("FAIL: IllformedLocaleException at offset " + i
+ " in test case: " + Utility.arrayToString(TESTCASE[tidx]));
}
}
}
if (expected != null) {
ULocale loc = bld.create();
if (!expected[1].equals(loc.toString())) {
errln("FAIL: Wrong locale ID - " + loc +
" for test case: " + Utility.arrayToString(TESTCASE[tidx]));
}
String langtag = loc.toLanguageTag();