public final class Assert extends Object
Assert is useful for embedding runtime sanity checks
 in code. The predicate methods all test a condition and throw some
 type of unchecked exception if the condition does not hold.
 Assertion failure exceptions, like most runtime exceptions, are thrown when something is misbehaving. Assertion failures are invariably unspecified behavior; consequently, clients should never rely on these being thrown (and certainly should not being catching them specifically).
This class is not intended to be instantiated or sub-classed by clients.
| Modifier and Type | Method and Description | 
|---|---|
static boolean | 
argument(boolean expression)
Asserts that an argument is legal. 
 | 
static boolean | 
argument(boolean expression,
        String message)
Asserts that an argument is legal. 
 | 
static void | 
notNull(Object object)
Asserts that the given object is not  
null. | 
static void | 
notNull(Object object,
       String message)
Asserts that the given object is not  
null. | 
static boolean | 
state(boolean expression)
Asserts that the given boolean is  
true. | 
static boolean | 
state(boolean expression,
     String message)
Asserts that the given boolean is  
true. | 
public static boolean argument(boolean expression)
true, an IllegalArgumentException
 is thrown.expression - the expression of the checktrue if the check passes (does not return
 if the check fails)IllegalArgumentException - if the legality test failedpublic static boolean argument(boolean expression,
                               String message)
true, an IllegalArgumentException
 is thrown.
 The given message is included in that exception, to aid debugging.expression - the result of the evaluated argument expressionmessage - the message to include in the exceptiontrue if the check passes (does not return
 if the check fails)IllegalArgumentException - if the legality test failedpublic static void notNull(Object object)
null. If this
 is not the case, some kind of unchecked exception is thrown.object - the value to testNullPointerException - if the object is nullpublic static void notNull(Object object, String message)
null. If this
 is not the case, some kind of unchecked exception is thrown.
 The given message is included in that exception, to aid debugging.object - the value to testmessage - the message to include in the exceptionNullPointerException - if the object is nullpublic static boolean state(boolean expression)
true. If this
 is not the case, some kind of unchecked exception is thrown.expression - the result of the evaluated state expressiontrue if the check passes (does not return
 if the check fails)IllegalStateException - if the given boolean is falsepublic static boolean state(boolean expression,
                            String message)
true. If this
 is not the case, some kind of unchecked exception is thrown.
 The given message is included in that exception, to aid debugging.expression - the result of the evaluated state expressionmessage - the message to include in the exceptiontrue if the check passes (does not return
 if the check fails)IllegalStateException - if the given boolean is falseCopyright © 2014–2022 European Space Agency (ESA). All rights reserved.