assertNotNull()
Purpose
Checks that an object is not null.
Syntax
assertNotNull( [<string>,]<object> )
where:
<string> is an optional message
<object> is a Java object
Description
The corresponding test result is Passed if <object> is not null, and Failed if the condition is False.
An optional <string> message can be logged and displayed in the test report.
If an exception is thrown in the assertNotNull() method, the test is stopped.
Examples
Object one_obj = new Long(10);
assertNotNull("assert not null passed", one_obj);
Object one_obj = new Long(10);
assertNotNull(one_obj);
Related Topics