doc / ch.tutteli.atrium.creating / CollectingExpect / addAssertionsCreatedBy

addAssertionsCreatedBy

abstract fun addAssertionsCreatedBy(assertionCreator: Expect<T>.() -> Unit): CollectingExpect<T>

Overrides Expect.addAssertionsCreatedBy

Adds the assertions created by the assertionCreator lambda to this container and adds a failing assertion to this container in case the assertionCreator did not create a single assertion.

A failing assertion is added to the container since we assume that the user or assertion function writer did a mistake and forgot to add an assertion. This can happen if one only creates assertions without adding them to the container or if one simply let the lambda empty.

Parameters

assertionCreator - The receiver function which should create and add assertions to this container.

Exceptions

AssertionError - Might throw an AssertionError depending on the concrete implementation.

Return
An Expect for the current subject of the assertion.