LANG-1271: StringUtils#isAnyEmpty and #isAnyBlank should return false for an empty array (closes #193)

This commit is contained in:
Pierre Templier 2016-09-24 14:52:42 +02:00 committed by pascalschumacher
parent 5acf310d08
commit 38140a5d8d
2 changed files with 10 additions and 10 deletions

View File

@ -247,7 +247,7 @@ public class StringUtils {
*/
public static boolean isAnyEmpty(final CharSequence... css) {
if (ArrayUtils.isEmpty(css)) {
return true;
return false;
}
for (final CharSequence cs : css){
if (isEmpty(cs)) {
@ -276,7 +276,7 @@ public class StringUtils {
*/
public static boolean isAnyNotEmpty(final CharSequence... css) {
if (ArrayUtils.isEmpty(css)) {
return true;
return false;
}
for (final CharSequence cs : css) {
if (isNotEmpty(cs)) {
@ -377,7 +377,7 @@ public class StringUtils {
*/
public static boolean isAnyBlank(final CharSequence... css) {
if (ArrayUtils.isEmpty(css)) {
return true;
return false;
}
for (final CharSequence cs : css){
if (isBlank(cs)) {
@ -407,7 +407,7 @@ public class StringUtils {
*/
public static boolean isAnyNotBlank(final CharSequence... css) {
if (ArrayUtils.isEmpty(css)) {
return true;
return false;
}
for (final CharSequence cs : css) {
if (isNotBlank(cs)) {

View File

@ -47,7 +47,7 @@ public class StringUtilsEmptyBlankTest {
@Test
public void testIsAnyEmpty() {
assertTrue(StringUtils.isAnyEmpty((String) null));
assertTrue(StringUtils.isAnyEmpty((String[]) null));
assertFalse(StringUtils.isAnyEmpty((String[]) null));
assertTrue(StringUtils.isAnyEmpty(null, "foo"));
assertTrue(StringUtils.isAnyEmpty("", "bar"));
assertTrue(StringUtils.isAnyEmpty("bob", ""));
@ -59,7 +59,7 @@ public class StringUtilsEmptyBlankTest {
@Test
public void testIsAnyNotEmpty() {
assertFalse(StringUtils.isAnyNotEmpty((String) null));
assertTrue(StringUtils.isAnyNotEmpty((String[]) null));
assertFalse(StringUtils.isAnyNotEmpty((String[]) null));
assertTrue(StringUtils.isAnyNotEmpty(null, "foo"));
assertTrue(StringUtils.isAnyNotEmpty("", "bar"));
assertTrue(StringUtils.isAnyNotEmpty("bob", ""));
@ -72,7 +72,7 @@ public class StringUtilsEmptyBlankTest {
@Test
public void testIsNoneEmpty() {
assertFalse(StringUtils.isNoneEmpty((String) null));
assertFalse(StringUtils.isNoneEmpty((String[]) null));
assertTrue(StringUtils.isNoneEmpty((String[]) null));
assertFalse(StringUtils.isNoneEmpty(null, "foo"));
assertFalse(StringUtils.isNoneEmpty("", "bar"));
assertFalse(StringUtils.isNoneEmpty("bob", ""));
@ -102,7 +102,7 @@ public class StringUtilsEmptyBlankTest {
@Test
public void testIsAnyBlank() {
assertTrue(StringUtils.isAnyBlank((String) null));
assertTrue(StringUtils.isAnyBlank((String[]) null));
assertFalse(StringUtils.isAnyBlank((String[]) null));
assertTrue(StringUtils.isAnyBlank(null, "foo"));
assertTrue(StringUtils.isAnyBlank(null, null));
assertTrue(StringUtils.isAnyBlank("", "bar"));
@ -115,7 +115,7 @@ public class StringUtilsEmptyBlankTest {
@Test
public void testIsAnyNotBlank() {
assertFalse(StringUtils.isAnyNotBlank((String) null));
assertTrue(StringUtils.isAnyNotBlank((String[]) null));
assertFalse(StringUtils.isAnyNotBlank((String[]) null));
assertTrue(StringUtils.isAnyNotBlank(null, "foo"));
assertFalse(StringUtils.isAnyNotBlank(null, null));
assertTrue(StringUtils.isAnyNotBlank("", "bar"));
@ -128,7 +128,7 @@ public class StringUtilsEmptyBlankTest {
@Test
public void testIsNoneBlank() {
assertFalse(StringUtils.isNoneBlank((String) null));
assertFalse(StringUtils.isNoneBlank((String[]) null));
assertTrue(StringUtils.isNoneBlank((String[]) null));
assertFalse(StringUtils.isNoneBlank(null, "foo"));
assertFalse(StringUtils.isNoneBlank(null, null));
assertFalse(StringUtils.isNoneBlank("", "bar"));