ICU-12586 Enables unit tests that were not included in the initial migration to JUnit.

X-SVN-Rev: 40151
This commit is contained in:
Norbert Runge 2017-06-05 16:17:11 +00:00
parent 425204d84b
commit 3b080265e2
14 changed files with 35 additions and 4 deletions

View File

@ -1294,6 +1294,7 @@ public class CollationAPITest extends TestFmwk {
}
}
@Test
public final void TestGetAll() {
Locale[] list = Collator.getAvailableLocales();
int errorCount = 0;

View File

@ -2281,16 +2281,16 @@ public class CollationMiscTest extends TestFmwk {
logln(" ");
}
public void
TestJ5367()
@Test
public void TestJ5367()
{
String[] test = { "a", "y" };
String rules = "&Ny << Y &[first secondary ignorable] <<< a";
genericRulesStarter(rules, test);
}
public void
TestVI5913()
@Test
public void TestVI5913()
{
String rules[] = {

View File

@ -1963,6 +1963,7 @@ public class IBMCalendarTest extends CalendarTestFmwk {
}
}
@Test
public void TestSimpleDateFormatCoverage() {
class StubSimpleDateFormat extends SimpleDateFormat {

View File

@ -280,6 +280,7 @@ public class IndianTest extends CalendarTestFmwk
}
}
@Test
public void TestCoverage12424() {
class StubCalendar extends IndianCalendar {
private static final long serialVersionUID = 1L;

View File

@ -125,6 +125,7 @@ public class PersianTest extends CalendarTestFmwk {
}
}
@Test
public void TestCoverage12424() {
class StubCalendar extends PersianCalendar {
private static final long serialVersionUID = 1L;

View File

@ -5022,6 +5022,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
assertEquals("hh bbbbb | 00:30:00", "12 a", sdf.format(k003000));
}
@Test
public void TestFlexibleDayPeriod() {
// Some times on 2015-11-13.
long k000000 = 1447372800000L;
@ -5120,6 +5121,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
assertEquals("hh BBBBB | 00:30:00", "12 at night", sdf.format(k003000));
}
@Test
public void TestDayPeriodWithLocales() {
// Some times on 2015-11-13 (UTC+0).
long k000000 = 1447372800000L;
@ -5195,6 +5197,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
assertEquals("hh:mm:ss BBBB | 01:00:00 | es", "01:00:00 de la madrugada", sdf.format(k010000));
}
@Test
public void TestMinuteSecondFieldsInOddPlaces() {
// Some times on 2015-11-13 (UTC+0).
long k000000 = 1447372800000L;
@ -5262,6 +5265,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
assertEquals("BBBB hh:mm:ss | 00:00:30", "at night 12:00:30", sdf.format(k000030));
}
@Test
public void TestDayPeriodParsing() throws ParseException {
// Some times on 2015-11-13 (UTC+0).
Date k000000 = new Date(1447372800000L);

View File

@ -886,6 +886,7 @@ public class DateTimeGeneratorTest extends TestFmwk {
/* Tests the method
* public String getCanonicalSkeletonAllowingDuplicates(String pattern)
*/
@Test
public void TestGetCanonicalSkeletonAllowingDuplicates(){
DateTimePatternGenerator dtpg = DateTimePatternGenerator.getInstance();
String[] cases = {"GyQMwEdaHmsSv","LegH","Legh"};

View File

@ -3076,6 +3076,7 @@ public class NumberFormatTest extends TestFmwk {
/*
* Coverage tests for the implementation of abstract format methods not being called otherwise
*/
@Test
public void TestFormatAbstractImplCoverage() {
NumberFormat df = DecimalFormat.getInstance(Locale.ENGLISH);
NumberFormat cdf = CompactDecimalFormat.getInstance(Locale.ENGLISH, CompactDecimalFormat.CompactStyle.SHORT);

View File

@ -85,6 +85,7 @@ public class PluralFormatUnitTest extends TestFmwk {
}
}
@Test
public void TestEquals() {
// There is neither clone() nor a copy constructor.
PluralFormat de_fee_1 = new PluralFormat(ULocale.GERMAN, PluralType.CARDINAL, "other{fee}");
@ -97,6 +98,7 @@ public class PluralFormatUnitTest extends TestFmwk {
assertFalse("different locales", de_fee_1.equals(fr_fee));
}
@Test
public void TestApplyPatternAndFormat() {
// Create rules for testing.
PluralRules oddAndEven = PluralRules.createRules("odd: n mod 2 is 1");

View File

@ -27,6 +27,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import org.junit.Ignore;
import org.junit.Test;
import com.ibm.icu.text.DateFormat;
@ -1998,6 +1999,7 @@ public class TestMessageFormat extends com.ibm.icu.dev.test.TestFmwk {
assertEquals("aa aaa", "AB ABC", mf3.format(args, new StringBuffer(), null).toString());
}
@Test
public void TestMessagePatternAutoQuoteApostropheDeep() {
// Example input & output taken from API docs.
MessagePattern pattern = new MessagePattern(
@ -2007,6 +2009,7 @@ public class TestMessageFormat extends com.ibm.icu.dev.test.TestFmwk {
pattern.autoQuoteApostropheDeep());
}
@Test
public void TestMessagePatternFreezable() {
MessagePattern pattern = new MessagePattern();
assertFalse("just constructed, not yet frozen", pattern.isFrozen());
@ -2028,6 +2031,7 @@ public class TestMessageFormat extends com.ibm.icu.dev.test.TestFmwk {
assertEquals("thawed+parse", "fo", thawed.autoQuoteApostropheDeep());
}
@Test
public void TestMessagePatternNamedAndNumberedArguments() {
MessagePattern pattern = new MessagePattern();
pattern.parse("fee");
@ -2044,6 +2048,7 @@ public class TestMessageFormat extends com.ibm.icu.dev.test.TestFmwk {
assertTrue("fum {0} {name} no numbered args", pattern.hasNumberedArguments());
}
@Test
public void TestMessagePatternPartCoverage() {
MessagePattern pattern = new MessagePattern("ab{17}c");
assertEquals("msg start { arg number } msg limit", 5, pattern.countParts());
@ -2055,6 +2060,7 @@ public class TestMessageFormat extends com.ibm.icu.dev.test.TestFmwk {
assertEquals("arg number 17", 17, arg.getValue());
}
@Test
public void TestMessagePatternParseChoiceStyle() {
// This would be tested by ChoiceFormat if ICU4J had its own version of that,
// like ICU4C does.
@ -2071,6 +2077,9 @@ public class TestMessageFormat extends com.ibm.icu.dev.test.TestFmwk {
assertTrue("many parts", pattern.countParts() > 10);
}
// TODO(junit): turned off for failure - need to investigate
@Ignore
@Test
public void TestDateFormatHashCode() {
DateFormat testDF = DateFormat.getDateInstance(DateFormat.DEFAULT, ULocale.GERMAN);
NumberFormat testNF = testDF.getNumberFormat();

View File

@ -678,6 +678,7 @@ public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk {
// Coverage tests for other versions of the parse() method. All of them end up
// calling the full parse() method tested on the TestParse() test.
@Test
public void TestParseCoverage() {
TimeZone expectedTZ = TimeZone.getTimeZone("America/Los_Angeles");
TimeZoneFormat fmt = TimeZoneFormat.getInstance(ULocale.ENGLISH);
@ -1050,6 +1051,7 @@ public class TimeZoneFormatTest extends com.ibm.icu.dev.test.TestFmwk {
// Tests format(Object, StringBuffer, FieldPosition):StringBuffer method
// inherited from Format class
@Test
public void TestInheritedFormat() {
TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
Calendar cal = Calendar.getInstance(tz);

View File

@ -868,6 +868,7 @@ public final class ICUResourceBundleTest extends TestFmwk {
}
@Test
public void TestCoverage(){
UResourceBundle bundle;
bundle = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME);

View File

@ -1175,6 +1175,7 @@ public class ULocaleTest extends TestFmwk {
}
}
@Test
public void TestDisplayLanguageWithDialectCoverage() {
// Coverage test. Implementation is in class LocaleDisplayNames.
assertFalse("en in system default locale: anything but empty",
@ -1187,6 +1188,7 @@ public class ULocaleTest extends TestFmwk {
ULocale.getDisplayLanguageWithDialect("en", "de"));
}
@Test
public void TestDisplayNameWithDialectCoverage() {
// Coverage test. Implementation is in class LocaleDisplayNames.
assertFalse("en-GB in system default locale: anything but empty",
@ -1199,6 +1201,7 @@ public class ULocaleTest extends TestFmwk {
ULocale.getDisplayNameWithDialect("en-GB", "de"));
}
@Test
public void TestDisplayScriptCoverage() {
// Coverage test. Implementation is in class LocaleDisplayNames.
assertFalse("zh-Hans in system default locale: anything but empty",

View File

@ -316,6 +316,7 @@ public class UnicodeMapTest extends TestFmwk {
static String[] TEST_VALUES = {"A", "B", "C", "D", "E", "F"};
static Random random = new Random(12345);
@Test
public void TestUnicodeMapRandom() {
// do random change to both, then compare
random.setSeed(12345); // reproducible results
@ -341,6 +342,7 @@ public class UnicodeMapTest extends TestFmwk {
private static final int SET_LIMIT = 0x10FFFF;
private static final int propEnum = UProperty.GENERAL_CATEGORY;
@Test
public void TestUnicodeMapGeneralCategory() {
logln("Setting General Category");
UnicodeMap<String> map1 = new UnicodeMap();
@ -377,6 +379,7 @@ public class UnicodeMapTest extends TestFmwk {
}
}
@Test
public void TestAUnicodeMap2() {
UnicodeMap foo = new UnicodeMap();
@SuppressWarnings("unused")
@ -385,6 +388,7 @@ public class UnicodeMapTest extends TestFmwk {
Set fii = foo.stringKeys(); // make sure doesn't NPE
}
@Test
public void TestAUnicodeMapInverse() {
UnicodeMap<Character> foo1 = new UnicodeMap<Character>()
.putAll('a', 'z', 'b')