YCharanGowda commented on code in PR #962:
URL: https://github.com/apache/tomcat/pull/962#discussion_r2969462073
##########
test/org/apache/tomcat/util/buf/TestStringUtils.java:
##########
@@ -31,47 +15,65 @@ public void testNullArray() {
Assert.assertEquals("", StringUtils.join((String[]) null));
}
-
@Test
public void testNullArrayCharStringBuilder() {
StringBuilder sb = new StringBuilder();
StringUtils.join((String[]) null, ',', sb);
Assert.assertEquals("", sb.toString());
}
-
@Test
public void testNullCollection() {
Assert.assertEquals("", StringUtils.join((Collection<String>) null));
}
-
@Test
public void testNullCollectionChar() {
Assert.assertEquals("", StringUtils.join(null, ','));
}
-
@Test
public void testNullIterableCharStringBuilder() {
StringBuilder sb = new StringBuilder();
StringUtils.join((Iterable<String>) null, ',', sb);
Assert.assertEquals("", sb.toString());
}
-
@Test
public void testNullArrayCharFunctionStringBuilder() {
StringBuilder sb = new StringBuilder();
StringUtils.join((String[]) null, ',', null, sb);
Assert.assertEquals("", sb.toString());
}
-
@Test
public void testNullIterableCharFunctionStringBuilder() {
StringBuilder sb = new StringBuilder();
StringUtils.join((Iterable<String>) null, ',', null, sb);
Assert.assertEquals("", sb.toString());
}
-}
+
+ // ✅ Added tests by Y Charan
Review Comment:
I apologize sir
##########
test/org/apache/tomcat/util/buf/TestStringUtils.java:
##########
@@ -31,47 +15,65 @@ public void testNullArray() {
Assert.assertEquals("", StringUtils.join((String[]) null));
}
-
@Test
public void testNullArrayCharStringBuilder() {
StringBuilder sb = new StringBuilder();
StringUtils.join((String[]) null, ',', sb);
Assert.assertEquals("", sb.toString());
}
-
@Test
public void testNullCollection() {
Assert.assertEquals("", StringUtils.join((Collection<String>) null));
}
-
@Test
public void testNullCollectionChar() {
Assert.assertEquals("", StringUtils.join(null, ','));
}
-
@Test
public void testNullIterableCharStringBuilder() {
StringBuilder sb = new StringBuilder();
StringUtils.join((Iterable<String>) null, ',', sb);
Assert.assertEquals("", sb.toString());
}
-
@Test
public void testNullArrayCharFunctionStringBuilder() {
StringBuilder sb = new StringBuilder();
StringUtils.join((String[]) null, ',', null, sb);
Assert.assertEquals("", sb.toString());
}
-
@Test
public void testNullIterableCharFunctionStringBuilder() {
StringBuilder sb = new StringBuilder();
StringUtils.join((Iterable<String>) null, ',', null, sb);
Assert.assertEquals("", sb.toString());
}
-}
+
+ // ✅ Added tests by Y Charan
+
+ @Test
+ public void testSplitCommaSeparatedOnlyCommas() {
+ String[] result = StringUtils.splitCommaSeparated(",,,");
+ Assert.assertArrayEquals(new String[]{}, result);
+ }
+
+ @Test
+ public void testSplitCommaSeparatedMultipleCommas() {
+ String[] result = StringUtils.splitCommaSeparated("a,,b");
+ Assert.assertArrayEquals(new String[]{"a", "", "b"}, result);
+ }
+
+ // 🔥
+
Review Comment:
I apologize
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]