yanghua commented on a change in pull request #1338: [HUDI-615]: Add Test cases 
for StringUtils.
URL: https://github.com/apache/incubator-hudi/pull/1338#discussion_r379903945
 
 

 ##########
 File path: 
hudi-common/src/test/java/org/apache/hudi/common/util/TestStringUtils.java
 ##########
 @@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.common.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestStringUtils {
+
+  @Test
+  public void testStringJoinWithDelim() {
+    String[] strings = {"This", "is", "not a", "test"};
+    String joinedString = StringUtils.joinUsingDelim("-", strings);
+    Assert.assertEquals(strings.length, (joinedString.split("-")).length);
+  }
+
+  @Test
+  public void testNullStringJoin() {
+    Assert.assertNull(StringUtils.join(null));
 
 Review comment:
   Can we use **static import** here for all these static assertion methods to 
remove `Assert.`
   And can we write a `testStringJoin` method to test the null and non-null 
scene(rather than write a method for a special scene)?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to