diff --git a/src/main/java/xyz/zhouxy/plusone/commons/util/Assert.java b/src/main/java/xyz/zhouxy/plusone/commons/util/Assert.java index 9a1a441..3fb524b 100644 --- a/src/main/java/xyz/zhouxy/plusone/commons/util/Assert.java +++ b/src/main/java/xyz/zhouxy/plusone/commons/util/Assert.java @@ -270,15 +270,21 @@ public class Assert { // hasText - String public static void hasText(@Nullable String str, Supplier e) throws E { - Assert.isTrue(MoreStrings.hasText(str), e); + if (!MoreStrings.hasText(str)) { + throw e.get(); + } } public static void hasText(@Nullable String str, String errorMessage) { - Assert.isTrue(MoreStrings.hasText(str), errorMessage); + if (!MoreStrings.hasText(str)) { + throw new IllegalArgumentException(errorMessage); + } } public static void hasText(@Nullable String str, String errorMessageTemplate, Object... args) { - Assert.isTrue(MoreStrings.hasText(str), errorMessageTemplate, args); + if (!MoreStrings.hasText(str)) { + throw new IllegalArgumentException(String.format(errorMessageTemplate, args)); + } } // private constructor