You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/11/05 14:53:57 UTC

[GitHub] [zookeeper] belugabehr commented on a change in pull request #1217: ZOOKEEPER-3691: Use JDK String Join Method in ZK StringUtils

belugabehr commented on a change in pull request #1217:
URL: https://github.com/apache/zookeeper/pull/1217#discussion_r518111724



##########
File path: zookeeper-server/src/test/java/org/apache/zookeeper/test/StringUtilTest.java
##########
@@ -19,24 +19,50 @@
 package org.apache.zookeeper.test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import java.util.Arrays;
+import java.util.Collections;
 import org.apache.zookeeper.ZKTestCase;
 import org.apache.zookeeper.common.StringUtils;
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 public class StringUtilTest extends ZKTestCase {
 
     @Test
-    public void testStrings() {
+    public void testStringSplit() {
+        final String s1 = "   a  ,   b  , ";
+        assertEquals(Arrays.asList("a", "b"), StringUtils.split(s1, ","));
 
-        String s1 = "   a  ,   b  , ";
-        assertEquals("[a, b]", StringUtils.split(s1, ",").toString());
+        assertEquals(Collections.emptyList(), StringUtils.split("", ","));
 
-        String s2 = "";
-        assertEquals(0, StringUtils.split(s2, ",").size());
+        final String s3 = "1, , 2";
+        assertEquals(Arrays.asList("1", "2"), StringUtils.split(s3, ","));
+    }
+
+    public void testStringJoinNullDelim() {

Review comment:
       Nice catch. Ya, JUNIT went from v4 -> v5 between my pull requests so I had to re-do some of the JUnit related stuff and clearly missed this one.  Thanks!  Changes made directly in GitHub.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org