doc / ch.tutteli.atrium.creating / IAssertionPlantNullable

IAssertionPlantNullable

interface IAssertionPlantNullable<out T> : IAssertionPlantWithCommonFields<T> (source)

Represents an assertion plant for nullable types.

In contrast to a IAssertionPlant it does not provide a method to create further IAssertions (IAssertionPlant.createAndAddAssertion) nor a method to add assertions (IAssertionPlant.addAssertion) and as consequence no method to check them (IAssertionPlant.checkAssertions). Yet, it provides one method isNull which immediately evaluates if the subject is null as expected.

Inherited Properties

commonFields abstract val commonFields: CommonFields<T>

CommonFields of this plant.

subject open val subject: T

The subject for which this plant will create/check IAssertions.

Functions

isNull abstract fun isNull(): Unit

Checks whether subject is null and reports an error if it is not.

Extension Functions

isNotNull fun <T : Any> IAssertionPlantNullable<T?>.isNotNull(): IAssertionPlant<T>

Makes the assertion that IAssertionPlant.subject is not null.

fun <T : Any> IAssertionPlantNullable<T?>.isNotNull(createAssertions: IAssertionPlant<T>.() -> Unit): IAssertionPlant<T>

Makes the assertion that IAssertionPlant.subject is not null and if so, uses createAssertions which could create further assertions which are lazily evaluated at the end.