Java/자카르타 Commons-lang Test 우혁이 아빠 2012. 4. 5. 16:44 @Test public void test004_BooleanUtils() throws Exception { assertThat(BooleanUtils.toStringTrueFalse(true), is("true")); assertThat(BooleanUtils.toStringTrueFalse(false), is("false")); assertThat(BooleanUtils.toStringYesNo(true), is("yes")); assertThat(BooleanUtils.toStringYesNo(false), is("no")); } @Test public void test005_CharUtils() throws Exception { assertThat(CharUtils.toChar("abc"), is('a')); assertThat(CharUtils.toIntValue('0'), is(0)); assertThat(CharUtils.unicodeEscaped('a'), is("\\u0061")); assertThat("\u0061".equals("a"), is(true)); } @Test public void test006_LocaleUtils() throws Exception { List availableLocaleList = LocaleUtils.availableLocaleList(); for (Locale locale : availableLocaleList) { logger.debug("locale : " + locale.toString()); } logger.debug("*************************************"); Set availableLocaleSet = LocaleUtils.availableLocaleSet(); for (Locale locale : availableLocaleSet) { logger.debug("locale : " + locale.toString()); } logger.debug("*************************************"); List countriesByLanguage = LocaleUtils.countriesByLanguage("ko"); for (Locale locale : countriesByLanguage) { logger.debug("locale : " + locale.toString()); } } @Test public void test007_RandomStringUtils() throws Exception { String random1 = RandomStringUtils.randomAlphabetic(10); logger.debug("random1 : " + random1); String random2 = RandomStringUtils.randomAlphanumeric(10); logger.debug("random2 : " + random2); } 저작자표시 (새창열림)