diff --git a/CHANGES.txt b/CHANGES.txt
index 1d586af3ba..85a83562c0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
Current
+Fixed: GITHUB-2465: Fix bux where Strings.join returns empty String
Fixed: GITHUB-1632: throwing SkipException sets iTestResult status to Failure instead of Skip (Julien Herr & Krishnan Mahadevan)
New : GITHUB-2456: Add onDataProviderFailure listener (Krishnan Mahadevan)
Fixed: GITHUB-2445: NPE in FailedReporter.java With Tests Created in Factory (Arham Jain)
diff --git a/src/main/java/org/testng/util/Strings.java b/src/main/java/org/testng/util/Strings.java
index bd008b01c0..54c0fcedf3 100644
--- a/src/main/java/org/testng/util/Strings.java
+++ b/src/main/java/org/testng/util/Strings.java
@@ -67,7 +67,7 @@ public static String join(String delimiter, String[] parts) {
for (int i = 0; i < parts.length - 1; i++) {
sb.append(parts[i]).append(delimiter);
}
- if (parts.length > 1) {
+ if (parts.length > 0) {
sb.append(parts[parts.length - 1]);
}
return sb.toString();
diff --git a/src/test/java/org/testng/util/StringsTest.java b/src/test/java/org/testng/util/StringsTest.java
new file mode 100644
index 0000000000..581540454c
--- /dev/null
+++ b/src/test/java/org/testng/util/StringsTest.java
@@ -0,0 +1,28 @@
+package org.testng.util;
+
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ * Unit tests for {@link Strings}
+ */
+public class StringsTest {
+ @Test
+ public void joinEmptyArray() {
+ String[] emptyArray = new String[0];
+ assertEquals(Strings.join(",", emptyArray), "");
+ }
+
+ @Test
+ public void joinArrayWithOneElement() {
+ String[] array = new String[]{"one"};
+ assertEquals(Strings.join(",", array), "one");
+ }
+
+ @Test
+ public void joinArrayWithTwoElements() {
+ String[] array = new String[]{"one", "two"};
+ assertEquals(Strings.join(",", array), "one,two");
+ }
+}
diff --git a/src/test/resources/testng.xml b/src/test/resources/testng.xml
index 15057bfad4..ebd485ed3f 100644
--- a/src/test/resources/testng.xml
+++ b/src/test/resources/testng.xml
@@ -767,6 +767,7 @@
+