assertNotNull

Asserts that the value is not null.

@safe pure
void
assertNotNull
(
T
)
(,
lazy string msg = null
,
string file = __FILE__
,
size_t line = __LINE__
)

Throws

AssertException otherwise

Examples

Object foo = new Object();

assertNotNull(foo);

auto exception = expectThrows!AssertException(assertNotNull(null));

assertEquals("Assertion failure", exception.msg);

Meta