Polish AssertUtil: add assertNotNull and assertTrue
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
This commit is contained in:
parent
1483669aaf
commit
4e41c14514
|
|
@ -26,6 +26,18 @@ public class AssertUtil {
|
|||
|
||||
private AssertUtil() {}
|
||||
|
||||
public static void assertNotNull(Object object, String message) {
|
||||
if (object == null) {
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void assertTrue(boolean value, String message) {
|
||||
if (!value) {
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void notEmpty(String string, String message) {
|
||||
if (StringUtil.isEmpty(string)) {
|
||||
throw new IllegalArgumentException(message);
|
||||
|
|
|
|||
Loading…
Reference in New Issue