### Question:
StringUtil { public static final Locale parseLocale(String languageTag, Locale defaultLocale) { if ( languageTag == null ) return defaultLocale; int idx = languageTag.indexOf('_'); if ( idx > 0 && idx < languageTag.length()-1 ) { String lang = languageTag.substring(0, idx); String country = languageTag.substring(idx+1); Locale locale = new Locale(lang, country); return locale; } else { return defaultLocale; } }  static final String substring(String line, String start, String end); static final String substringR(String line, String start, String end); static final String concat(Object ... value ); static final int toInt(String str, int defaultValue); static final float toFloat(String str, float defaultValue); static final boolean checkNotEmpty(String str); static final void padStringRight(StringBuilder buf, String str, int length); static final String bytesToHexString(byte[] bytes); static final byte[] hexStringToBytes(String hexString); static final String[] splitMachineId(String machineId); static final Locale parseLocale(String languageTag, Locale defaultLocale); static final boolean checkValidEmail(String emailAddress); static String encryptSHA1(String data); static String encryptMD5(String data);  }### Answer:
@Test public void testParseLocale() { String localeStr = "zh_CN"; Locale locale = StringUtil.parseLocale(localeStr, Locale.US); System.out.println(locale); assertEquals(Locale.SIMPLIFIED_CHINESE, locale); }
@Test public void testParseLocaleZH() { String localeStr = "zh"; Locale locale = StringUtil.parseLocale(localeStr, Locale.CHINESE); System.out.println(locale); assertEquals(Locale.CHINESE, locale); }
@Test public void testParseLocaleNull() { String localeStr = null; Locale locale = StringUtil.parseLocale(localeStr, Locale.US); System.out.println(locale); assertEquals(Locale.US, locale); }
@Test public void testParseLocaleNull2() { String localeStr = Constant.EMPTY; Locale locale = StringUtil.parseLocale(localeStr, Locale.US); System.out.println(locale); assertEquals(Locale.US, locale); }