com/ibm/icu/text/SimpleDateFormat#subParse:(Ljava/lang/String;ICIZZ[ZLcom/ibm/icu/util/Calendar;)I
com/ibm/icu/text/SimpleDateFormat$ContextValue#valueOf:(Ljava/lang/String;)Lcom/ibm/icu/text/SimpleDateFormat$ContextValue;
com/ibm/icu/text/SimpleDateFormat$ContextValue#values:()[Lcom/ibm/icu/text/SimpleDateFormat$ContextValue;
-com/ibm/icu/text/SpoofChecker#getRestrictionLevel:()Lcom/ibm/icu/text/SpoofChecker$RestrictionLevel;
-com/ibm/icu/text/SpoofChecker#hashCode:()I
-com/ibm/icu/text/SpoofChecker$Builder#<init>:(Lcom/ibm/icu/text/SpoofChecker;)V
-com/ibm/icu/text/SpoofChecker$Builder$WSConfusableDataBuilder#<init>:()V
-com/ibm/icu/text/SpoofChecker$ScriptSet#output:(Ljava/io/DataOutputStream;)V
-com/ibm/icu/text/SpoofChecker$ScriptSet#resetAll:()V
-com/ibm/icu/text/SpoofChecker$ScriptSet#Union:(Lcom/ibm/icu/text/SpoofChecker$ScriptSet;)V
+com/ibm/icu/text/SpoofChecker$Builder#<init>:(Lcom/ibm/icu/text/SpoofChecker;)Vcom/ibm/icu/text/SpoofChecker$ConfusableDataUtils#<init>:()V
+com/ibm/icu/text/SpoofChecker$ConfusableDataUtils#<init>:()V
+com/ibm/icu/text/SpoofChecker$RestrictionLevel#valueOf:(Ljava/lang/String;)Lcom/ibm/icu/text/SpoofChecker$RestrictionLevel;
com/ibm/icu/text/SpoofChecker$SpoofData$DefaultData#<init>:()V
com/ibm/icu/text/StringCharacterIterator#equals:(Ljava/lang/Object;)Z
com/ibm/icu/text/StringCharacterIterator#first:()C
com/ibm/icu/util/VersionInfo#getVersionString:(II)Ljava/lang/String;
com/ibm/icu/util/VersionInfo#main:([Ljava/lang/String;)V
com/ibm/icu/util/VTimeZone#observesDaylightTime:()Z
+
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.text.ParseException;
+import java.util.BitSet;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Locale;
import com.ibm.icu.dev.test.TestUtil;
import com.ibm.icu.dev.test.TestUtil.JavaVendor;
import com.ibm.icu.impl.Utility;
+import com.ibm.icu.lang.UScript;
import com.ibm.icu.text.Normalizer2;
import com.ibm.icu.text.SpoofChecker;
import com.ibm.icu.text.SpoofChecker.CheckResult;
boolean expectedFailure = expectedLevel.compareTo(levelSetInSpoofChecker) > 0;
assertEquals("Testing spoof restriction level for '" + testString + "', " + levelSetInSpoofChecker,
expectedFailure, actualValue);
+
+ // Coverage for getRestrictionLevel
+ assertEquals("Restriction level on built SpoofChecker should be same as on builder",
+ levelSetInSpoofChecker, sc.getRestrictionLevel());
}
}
}
}
}
+ @Test
+ public void testScriptSet() {
+ try {
+ Class ScriptSet = Class.forName("com.ibm.icu.text.SpoofChecker$ScriptSet");
+ Constructor ctor = ScriptSet.getDeclaredConstructor();
+ ctor.setAccessible(true);
+ BitSet ss = (BitSet) ctor.newInstance();
+
+ ss.set(UScript.MYANMAR);
+ assertEquals("ScriptSet toString with Myanmar", "<ScriptSet { Mymr }>", ss.toString());
+ ss.set(UScript.BENGALI);
+ ss.set(UScript.LATIN);
+ assertEquals("ScriptSet toString with Myanmar, Latin, and Bengali", "<ScriptSet { Beng Latn Mymr }>", ss.toString());
+
+ Method and = ScriptSet.getDeclaredMethod("and", Integer.TYPE);
+ and.setAccessible(true);
+ and.invoke(ss, UScript.BENGALI);
+ assertEquals("ScriptSet toString with Bengali only", "<ScriptSet { Beng }>", ss.toString());
+
+ Method setAll = ScriptSet.getDeclaredMethod("setAll");
+ setAll.setAccessible(true);
+ setAll.invoke(ss);
+ assertEquals("ScriptSet toString with all scripts", "<ScriptSet { * }>", ss.toString());
+
+ Method isFull = ScriptSet.getDeclaredMethod("isFull");
+ isFull.setAccessible(true);
+ boolean result = (Boolean) isFull.invoke(ss);
+ assertEquals("ScriptSet should evaluate as full", true, result);
+
+ } catch (ClassNotFoundException e) {
+ fail("Failed while testing ScriptSet: " + e.getClass() + ": " + e.getMessage());
+ } catch (InstantiationException e) {
+ fail("Failed while testing ScriptSet: " + e.getClass() + ": " + e.getMessage());
+ } catch (IllegalAccessException e) {
+ fail("Failed while testing ScriptSet: " + e.getClass() + ": " + e.getMessage());
+ } catch (SecurityException e) {
+ fail("Failed while testing ScriptSet: " + e.getClass() + ": " + e.getMessage());
+ } catch (NoSuchMethodException e) {
+ fail("Failed while testing ScriptSet: " + e.getClass() + ": " + e.getMessage());
+ } catch (IllegalArgumentException e) {
+ fail("Failed while testing ScriptSet: " + e.getClass() + ": " + e.getMessage());
+ } catch (InvocationTargetException e) {
+ fail("Failed while testing ScriptSet: " + e.getClass() + ": " + e.getMessage());
+ }
+ }
}