open static fun state(expression: Boolean, message: String): Unit
Assert a boolean expression, throwing an IllegalStateException if the expression evaluates to false.
Call #isTrue if you wish to throw an IllegalArgumentException on an assertion failure.
Assert.state(id == null, "The id property must not already be initialized");
expression - a boolean expression
message - the exception message to use if the assertion fails
IllegalStateException - if expression is false
open static fun state(expression: Boolean, messageSupplier: Supplier<String>): Unit
Assert a boolean expression, throwing an IllegalStateException if the expression evaluates to false.
Call #isTrue if you wish to throw an IllegalArgumentException on an assertion failure.
Assert.state(id == null, () -> "ID for " + entity.getName() + " must not already be initialized");
expression - a boolean expression
messageSupplier - a supplier for the exception message to use if the assertion fails
IllegalStateException - if expression is false
Since
5.0
open static fun state(expression: Boolean): Unit