Pinyin { public static boolean isChinese(char c) { return (PinyinData.MIN_VALUE <= c && c <= PinyinData.MAX_VALUE && getPinyinCode(c) > 0) || PinyinData.CHAR_12295 == c; } private  Pinyin(); static void init(Config config); static void add(PinyinDict dict); static Config newConfig(); static String toPinyin(String str, String separator); static String toPinyin(String str, String separator, PinyinRules rules); static String toPinyin(char c); static String toPinyin(char c, PinyinRules rules); static boolean isChinese(char c);  }
@Test public void testToPinyin_traditional_chars() throws BadHanyuPinyinOutputFormatCombination { for (char c : TraditionalCharSet.All) { assertThat(Pinyin.isChinese(c), is(true)); } }
@Test public void testIsChinese() throws BadHanyuPinyinOutputFormatCombination { char[] allChars = allChars(); final int allCharsLength = allChars.length; HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat(); format.setToneType(HanyuPinyinToneType.WITHOUT_TONE); format.setCaseType(HanyuPinyinCaseType.UPPERCASE); format.setVCharType(HanyuPinyinVCharType.WITH_V); for (int i = 0; i < allCharsLength; i++) { char targetChar = allChars[i]; String[] pinyins = PinyinHelper.toHanyuPinyinStringArray(targetChar, format); if (pinyins != null && pinyins.length > 0) { assertThat(Pinyin.isChinese(targetChar), is(true)); } else { assertThat(Pinyin.isChinese(targetChar), is(false)); } } }