Assert-NotNull

Asserts that an object isn't $null.

Syntax

Assert-NotNull [[-InputObject] <Object>] [[-Message] <String>] [<CommonParameters>]

Parameters

Name Type Description Required? Pipeline Input Default Value
InputObject Object

The object to check.

false false
Message String

A reason why the assertion fails.

false false

EXAMPLE 1

Assert-NotNull $null

Demonstrates how to fail a test by asserting that $null isn't $null.

EXAMPLE 2

Assert-NotNull $object 'The foo didn''t bar!'

Demonstrates how to give a descriptive error about why the assertion might be failing.