doc / ch.tutteli.atrium.domain.builders / AssertImpl / changeSubject

changeSubject

fun <T, R : Any> changeSubject(originalPlant: BaseAssertionPlant<T, *>, subjectProvider: () -> R): AssertionPlant<R> (source)

Creates a new AssertionPlant based on the given subjectProvider whereas the AssertionPlant delegates assertion checking to the given originalPlant.

This method is useful if you want to make feature assertion(s) but you do not want that the feature is shown up in reporting. For instance, if a class can behave as another class (e.g. Sequence::asIterable) or you want to hide a conversion (e.g. Int::toChar) then you can use this function.

Notice, if you do not require the resulting AssertionPlant but merely want to make feature assertions so that you can use them as part of a bigger assertion, then use collector instead.