LANG-1169 Add some other unit tests

This commit is contained in:
Loic Guibert 2015-11-06 16:13:13 +04:00
parent 3a68fe8b7e
commit a06f83a762
2 changed files with 12 additions and 0 deletions

View File

@ -1013,6 +1013,7 @@ public class StringUtils {
* returning {@code true} if the <code>string</code> is equal to any of the <code>searchStrings</code>.</p>
*
* <pre>
* 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 the <code>string</code> is equal to any of the <code>searchStrings</code>, ignoring case.</p>
*
* <pre>
* StringUtils.equalsAnyIgnoreCase(null, (CharSequence[]) null) = false
* StringUtils.equalsAnyIgnoreCase(null, null, null) = true
* StringUtils.equalsAnyIgnoreCase(null, "abc", "def") = false
* StringUtils.equalsAnyIgnoreCase("abc", null, "def") = false

View File

@ -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")));
}
//-----------------------------------------------------------------------