ChineseUtils { public String getSpelling(String chinese) { if (chinese == null) return ""; String key, value; StringBuilder buffer = new StringBuilder(); for (int i = 0; i < chinese.length(); i++) { key = chinese.substring(i, i + 1); if (key.getBytes().length >= 2) { value = convert(key); if (value == null) { value = "unknown"; } } else { value = key; } buffer.append(value); } return buffer.toString(); }  static ChineseUtils getInstance(); String getResource(); void setResource(String resource); String convert(String chinese); String getSpelling(String chinese); String getSpelling(); String getSpellingFirstLetterUpper(String chinese); String getSpellingFirstLetterLower(String chinese); static String[] spellingString; }
@Test public void getSpelling() throws Exception { String spelling = ChineseUtils.getInstance().getSpelling(SENTENCE); System.out.println(TAG + " >>>>>>>> getSpelling "); System.out.println(TAG + " >> getSpelling >> Sentence >> " + SENTENCE); System.out.println(TAG + " >> getSpelling >> Sentence chinese >> " + SENTENCE_CHINESE); System.out.println(TAG + " >> getSpelling >> spelling >> " + spelling); System.out.println(); assertEquals(SENTENCE_CHINESE, spelling); }