diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index f2faa68e7..cb3579640 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -1013,6 +1013,7 @@ public class StringUtils {
* returning {@code true} if the string
is equal to any of the searchStrings
.
+ * StringUtils.equalsAny(null, (CharSequence[]) null) = false * StringUtils.equalsAny(null, null, null) = true * StringUtils.equalsAny(null, "abc", "def") = false * StringUtils.equalsAny("abc", null, "def") = false @@ -1043,6 +1044,7 @@ public class StringUtils { * returning {@code true} if thestring
is equal to any of thesearchStrings
, ignoring case. * *+ * StringUtils.equalsAnyIgnoreCase(null, (CharSequence[]) null) = false * StringUtils.equalsAnyIgnoreCase(null, null, null) = true * StringUtils.equalsAnyIgnoreCase(null, "abc", "def") = false * StringUtils.equalsAnyIgnoreCase("abc", null, "def") = false diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java index cf6b815fc..8750de3f1 100644 --- a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java +++ b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java @@ -595,6 +595,12 @@ public class StringUtilsEqualsIndexOfTest { assertFalse(StringUtils.equalsAny(FOO, null, BAR)); assertTrue(StringUtils.equalsAny(FOO, BAR, null, "", FOO, BAR)); assertFalse(StringUtils.equalsAny(FOO, FOO.toUpperCase())); + + assertFalse(StringUtils.equalsAny(null, (CharSequence[]) null)); + assertTrue(StringUtils.equalsAny(FOO, new CustomCharSequence("foo"))); + assertTrue(StringUtils.equalsAny(FOO, new StringBuilder("foo"))); + assertFalse(StringUtils.equalsAny(FOO, new CustomCharSequence("fOo"))); + assertFalse(StringUtils.equalsAny(FOO, new StringBuilder("fOo"))); } @Test @@ -617,6 +623,10 @@ public class StringUtilsEqualsIndexOfTest { assertFalse(StringUtils.equalsAnyIgnoreCase(FOO, null, BAR)); assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, BAR, null, "", FOO.toUpperCase(), BAR)); assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, FOO.toUpperCase())); + + assertFalse(StringUtils.equalsAnyIgnoreCase(null, (CharSequence[]) null)); + assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, new CustomCharSequence("fOo"))); + assertTrue(StringUtils.equalsAnyIgnoreCase(FOO, new StringBuilder("fOo"))); } //-----------------------------------------------------------------------