Package com.xxl.tool.core
Class AssertTool
java.lang.Object
com.xxl.tool.core.AssertTool
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAssert that a string is blank.static voidAssert that a boolean expression evaluating tofalseistrue.static voidAssert that an object isnull.static voidAssert a boolean expression, throwing anIllegalArgumentExceptionif the expression evaluates tofalse.static voidAssert that a string is not blank.static voidAssert that an object is notnull.
-
Constructor Details
-
AssertTool
public AssertTool()
-
-
Method Details
-
isTrue
Assert a boolean expression, throwing anIllegalArgumentExceptionif the expression evaluates tofalse.Assert.isTrue(i > 0, "The value must be greater than zero");- Parameters:
expression- a boolean expressionmessage- the exception message to use if the assertion fails- Throws:
IllegalArgumentException- ifexpressionisfalse
-
isFalse
Assert that a boolean expression evaluating tofalseistrue.- Parameters:
expression- a boolean expressionmessage- the exception message to use if the assertion fails
-
isNull
Assert that an object isnull.Assert.isNull(value, "The value must be null");- Parameters:
object- the object to checkmessage- the exception message to use if the assertion fails- Throws:
IllegalArgumentException- if the object is notnull
-
notNull
Assert that an object is notnull.Assert.notNull(clazz, "The class must not be null");- Parameters:
object- the object to checkmessage- the exception message to use if the assertion fails- Throws:
IllegalArgumentException- if the object isnull
-
isBlank
Assert that a string is blank.- Parameters:
str- the string to checkmessage- the exception message to use if the assertion fails
-
notBlank
Assert that a string is not blank.- Parameters:
str- the string to checkmessage- the exception message to use if the assertion fails
-