atrium-impl-robstoll / ch.tutteli.atrium.creating / IAssertionPlant

IAssertionPlant

interface IAssertionPlant<out T : Any> : IAssertionPlantWithCommonFields<T> (source)

Represents a plant for IAssertions and offers the possibility to check all the added assertions.

You can think of it as an IAssertion factory which does more than just factoring but also provides quality assurance capabilities.

Properties

and open val and: IAssertionPlant<T>

Can be used to separate assertions when using the fluent-style API.

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

addAssertion abstract fun addAssertion(assertion: IAssertion): IAssertionPlant<T>

Adds the given assertion to the plant.

checkAssertions abstract fun checkAssertions(): IAssertionPlant<T>

Checks the so far added IAssertions and reports if one of them fails.

createAndAddAssertion abstract fun createAndAddAssertion(description: String, expected: Any, test: () -> Boolean): IAssertionPlant<T>

Creates an IAssertion based on description, expected and test and adds it to the plant.

Extension Functions

createAssertionsAndCheckThem fun <T : Any> IAssertionPlant<T>.createAssertionsAndCheckThem(createAssertions: IAssertionPlant<T>.() -> Unit): IAssertionPlant<T>

Uses this plant as receiver of the given createAssertions function and then calls IAssertionPlant.checkAssertions.