StringUtil { public static String getExtension(String name) { if (name == null) { return null; } int index = name.lastIndexOf('.'); return (index < 0) ? "" : name.substring(index); }  static boolean isWhitespace(char c); static boolean isZenHankakuSpace(char c); static String rtrim(String str); static String ltrim(String str); static String trim(String str); static String rtrimZ(String str); static String ltrimZ(String str); static String trimZ(String str); static String toShortClassName(String longClassName); static String getExtension(String name); static String toHexString(byte[] byteArray, String delim); static String capitalizeInitial(String str); static String[] parseCSV(String csvString); static String[] parseCSV(String csvString, String escapeString); static String dump(Map<?, ?> map); static String getArraysStr(Object[] arrayObj); static String hankakuToZenkaku(String value); static String zenkakuToHankaku(String value); static String filter(String str); static String toLikeCondition(String condition); static int getByteLength(String value, String encoding); static final String LINE_SEP; static final String LIKE_ESC_CHAR; }
@Test public void testGetExtention01() throws Exception { String input = "sample.txt"; String result = StringUtil.getExtension(input); assertEquals(".txt", result); }
@Test public void testGetExtention02() throws Exception { String input = "sample"; String result = StringUtil.getExtension(input); assertEquals("", result); }
@Test public void testGetExtention03() throws Exception { String input = "sample.txt.bak"; String result = StringUtil.getExtension(input); assertEquals(".bak", result); }
@Test public void testGetExtention04() throws Exception { String input = null; String result = StringUtil.getExtension(input); assertNull(result); }
@Test public void testGetExtention05() throws Exception { String input = ""; String result = StringUtil.getExtension(input); assertEquals("", result); }
@Test public void testGetExtention06() throws Exception { String input = "sample.txt."; String result = StringUtil.getExtension(input); assertEquals(".", result); }