From d43c3993fbcc908f8207791c0a80990a5b0746af Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Sun, 17 Apr 2016 21:28:49 +0000 Subject: [PATCH] add unit test for StringUtil#join git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1739660 13f79535-47bb-0310-9956-ffa450edef68 --- src/testcases/org/apache/poi/util/TestStringUtil.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/testcases/org/apache/poi/util/TestStringUtil.java b/src/testcases/org/apache/poi/util/TestStringUtil.java index 0134ff0f71..002c8dcd2d 100644 --- a/src/testcases/org/apache/poi/util/TestStringUtil.java +++ b/src/testcases/org/apache/poi/util/TestStringUtil.java @@ -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 + } } -- 2.39.5