doc / ch.tutteli.atrium.domain.creating.changers / SubjectChanger / unreported

unreported

abstract fun <T, R> unreported(originalAssertionContainer: Expect<T>, transformation: (T) -> R): Expect<R>

Changes to a new subject according to the given transformation without showing it in reporting and returns a new Expect for the new subject.

Explained a bit more in depth: it creates a new Expect incorporating the given transformation whereas the new Expect delegates assertion checking to the given originalAssertionContainer - the change as such will not be reflected in reporting.

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, in case the change to the new subject is not always safe (you assert so but it does not have to be), then you should use reported so that the assertion is reflected in reporting.

Parameters

originalAssertionContainer - the assertion container with the current subject (before the change) -- if you use ExpectImpl.changeSubject(...).unreported within an assertion function (an extension function of Expect) then you usually pass this (so the instance of Expect) for this parameter.

transformation - Provides the subject.

Return
The newly created Expect.