add unit test for StringUtil#join

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1739660 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-04-17 21:28:49 +00:00
parent 556f1e78a1
commit ba64b65412

View File

@ -184,5 +184,13 @@ public class TestStringUtil {
assertFalse("trailing whitespace should not be ignored", StringUtil.endsWithIgnoreCase("Apache POI project ", "Apache POI"));
assertFalse("shorter string", StringUtil.endsWithIgnoreCase("Apache", "Apache POI"));
}
@Test
public void join() {
assertEquals("", StringUtil.join(",")); // degenerate case: nothing to join
assertEquals("abc", StringUtil.join(",", "abc")); // degenerate case: one thing to join, no trailing comma
assertEquals("abc|def|ghi", StringUtil.join("|", "abc", "def", "ghi"));
assertEquals("5|8.5|true|string", StringUtil.join("|", 5, 8.5, true, "string")); //assumes Locale prints number decimal point as a period rather than a comma
}
}