mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-6958 Fixed a bug within a test case and increased code coverage for com.ibm.icu.text.
X-SVN-Rev: 26274
This commit is contained in:
parent
7f95e441c1
commit
623b0548ca
5 changed files with 100 additions and 7 deletions
|
@ -124,7 +124,11 @@ class TransliteratorRegistry {
|
|||
}
|
||||
}
|
||||
}catch(MissingResourceException e){
|
||||
///CLOVER:OFF
|
||||
// The constructor is called from multiple private methods
|
||||
// that protects an invalid scriptName
|
||||
scriptName = null;
|
||||
///CLOVER:ON
|
||||
}
|
||||
// assert(spec != top);
|
||||
reset();
|
||||
|
|
|
@ -3642,7 +3642,7 @@ public class DateFormatTest extends com.ibm.icu.dev.test.TestFmwk {
|
|||
*/
|
||||
public void TestOfCalendarField() {
|
||||
// Tests when if (calendarField == ChineseCalendar.IS_LEAP_MONTH) is false
|
||||
int[] cases = { ChineseCalendar.IS_LEAP_MONTH - 1, ChineseCalendar.IS_LEAP_MONTH + 1 };
|
||||
int[] cases = { ChineseCalendar.IS_LEAP_MONTH - 1};
|
||||
for (int i = 0; i < cases.length; i++) {
|
||||
try {
|
||||
Field.ofCalendarField(cases[i]);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007-2008, International Business Machines Corporation and *
|
||||
* Copyright (C) 2007-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007-2008, International Business Machines Corporation and *
|
||||
* Copyright (C) 2007-2009, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
@ -181,4 +181,53 @@ public class PluralRulesTest extends TestFmwk {
|
|||
|
||||
assertEquals("locales are unique in list", locales.length, localeSet.size());
|
||||
}
|
||||
|
||||
/*
|
||||
* Test the method public static PluralRules parseDescription(String description)
|
||||
*/
|
||||
public void TestParseDescription() {
|
||||
try {
|
||||
if (PluralRules.DEFAULT != PluralRules.parseDescription("")) {
|
||||
errln("PluralRules.parseDescription(String) was suppose "
|
||||
+ "to return PluralRules.DEFAULT when String is of " + "length 0.");
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
errln("PluralRules.parseDescription(String) was not suppose " + "to return an exception.");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests the method public static PluralRules createRules(String description)
|
||||
*/
|
||||
public void TestCreateRules() {
|
||||
try {
|
||||
if (PluralRules.createRules(null) != null) {
|
||||
errln("PluralRules.createRules(String) was suppose to "
|
||||
+ "return null for an invalid String descrtiption.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests the method public int hashCode()
|
||||
*/
|
||||
public void TestHashCode() {
|
||||
PluralRules pr = PluralRules.DEFAULT;
|
||||
if (106069776 != pr.hashCode()) {
|
||||
errln("PluralRules.hashCode() was suppose to return 106069776 " + "when PluralRules.DEFAULT.");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests the method public boolean equals(PluralRules rhs)
|
||||
*/
|
||||
public void TestEquals() {
|
||||
PluralRules pr = PluralRules.DEFAULT;
|
||||
|
||||
// Tests when if (rhs == null) is true
|
||||
if (pr.equals((PluralRules) null)) {
|
||||
errln("PluralRules.equals(PluralRules) was suppose to return false " + "when passing null.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,14 +6,29 @@
|
|||
*/
|
||||
package com.ibm.icu.dev.test.translit;
|
||||
|
||||
import com.ibm.icu.lang.*;
|
||||
import com.ibm.icu.text.*;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.ibm.icu.dev.test.*;
|
||||
import com.ibm.icu.impl.Utility;
|
||||
import com.ibm.icu.impl.UtilityExtensions;
|
||||
import com.ibm.icu.lang.UCharacter;
|
||||
import com.ibm.icu.lang.UScript;
|
||||
import com.ibm.icu.text.Replaceable;
|
||||
import com.ibm.icu.text.ReplaceableString;
|
||||
import com.ibm.icu.text.StringTransform;
|
||||
import com.ibm.icu.text.Transliterator;
|
||||
import com.ibm.icu.text.UTF16;
|
||||
import com.ibm.icu.text.UnicodeFilter;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
import com.ibm.icu.text.UnicodeSetIterator;
|
||||
import com.ibm.icu.util.CaseInsensitiveString;
|
||||
import com.ibm.icu.util.ULocale;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
||||
|
@ -3691,7 +3706,32 @@ the ::BEGIN/::END stuff)
|
|||
assertEquals(message + " " +source2, expected, t.transform(source2));
|
||||
assertEquals(message + " " + expected, source, back.transform(expected));
|
||||
}
|
||||
|
||||
|
||||
/* Tests the method
|
||||
* public Enumeration<String> getAvailableTargets(String source)
|
||||
*/
|
||||
public void TestGetAvailableTargets(){
|
||||
try{
|
||||
// Tests when if (targets == null) is true
|
||||
Transliterator.getAvailableTargets("");
|
||||
} catch(Exception e){
|
||||
errln("TransliteratorRegistry.getAvailableTargets(String) was not " +
|
||||
"suppose to return an exception.");
|
||||
}
|
||||
}
|
||||
|
||||
/* Tests the method
|
||||
* public Enumeration<String> getAvailableVariants(String source, String target)
|
||||
*/
|
||||
public void TestGetAvailableVariants(){
|
||||
try{
|
||||
// Tests when if (targets == null) is true
|
||||
Transliterator.getAvailableVariants("","");
|
||||
} catch(Exception e){
|
||||
errln("TransliteratorRegistry.getAvailableVariants(String) was not " +
|
||||
"suppose to return an exception.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue