### Question:
StringUtil { public static List<String> parseSeparatedStringToListIfListIsNull( String separatedStr, List<String> list) { if (null != list) { return list; } list = new ArrayList<String>(); if (null == separatedStr) { return list; } String[] splits = StringUtils.split(separatedStr, ";"); for (String tld : splits) { tld = StringUtils.trim(tld); if (StringUtils.isNotBlank(tld)) { list.add(tld); } } return list; } private  StringUtil(); static List<MediaType> parseMediaTypes(String mediaTypesStr); static MediaType parseMediaType(String mediaTypeStr); static boolean containNonAsciiPrintableChars(String decodeUri); static String generateEncodedRedirectURL(String param,
            String servicePartUri, String baseUrl); static List<String> parseSeparatedStringToListIfListIsNull(
            String separatedStr, List<String> list); static String addQuotas(String str); static boolean checkIsValidSearchPattern(String str); static boolean containsAtMostOnce(String str, String searchStr); static boolean isValidEntityHandleOrName(String handle); static String urlEncode(String str); static String getNormalization(String str); static long parseUnsignedLong(String s); static String foldCase(String strParam); static String foldCaseAndNormalization(String strParam); static List<String> getNotEmptyStringList(List<String> stringList); static final String SPACE; static final String TLD_SPLITOR; static final String ASTERISK; static final String CHAR_SET_UTF8; static final String CHAR_SET_ISO8859; static final int MAX_ENTITY_HANDLE_LENGTH; }### Answer:
@Test public void testParseTldsToListIfTldListIsNull() { assertThat( StringUtil.parseSeparatedStringToListIfListIsNull("cn", null), CoreMatchers.hasItems("cn")); assertThat(StringUtil.parseSeparatedStringToListIfListIsNull( "edu.cn;cn", null), CoreMatchers.hasItems("cn", "edu.cn")); assertThat(StringUtil.parseSeparatedStringToListIfListIsNull( "cn;edu.cn", null), CoreMatchers.hasItems("cn", "edu.cn")); assertThat(StringUtil.parseSeparatedStringToListIfListIsNull( "cn;edu.cn;", null), CoreMatchers.hasItems("cn", "edu.cn")); assertThat(StringUtil.parseSeparatedStringToListIfListIsNull( ";cn;edu.cn;", null), CoreMatchers.hasItems("cn", "edu.cn")); assertThat(StringUtil.parseSeparatedStringToListIfListIsNull( ";cn;edu.cn", null), CoreMatchers.hasItems("cn", "edu.cn")); List<String> tldList = new ArrayList<String>(); tldList.add("cn"); tldList.add("edu.cn"); assertThat(StringUtil.parseSeparatedStringToListIfListIsNull("com.cn", tldList), CoreMatchers.hasItems("cn", "edu.cn")); }