reported
Changes to a new subject according to the given transformation -- the change as such is reflected in reporting by the given description and representation.
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 container. The transformation as such can either return the new subject wrapped in a Some or return None in case the transformation cannot be carried out.
This method is useful if you want to change the subject whereas the change as such is assertion like as well, so that it should be reported as well. For instance, say you want to change the subject of type Int?
to Int
. Since the subject could also be null
it makes sense to report this assertion instead of failing with an exception.
Return
The newly created Expect for the extracted feature.
Parameters
the assertion container with the current subject (before the change)
Describes the kind of subject change (e.g. in case of a type change is a
).
Representation of the change (e.g. in case of a type transformation the KClass).
Provides the subject wrapped into a Some if the extraction as such can be carried out otherwise None.
The FailureHandler which shall be used in case the subject cannot be transformed. A failure has the chance to augment the failing assertion representing the failed transformation with further information.
Optionally, subsequent expectations for the new subject. This is especially useful if the change fails since we can then already show to you (in error reporting) what you wanted to assert about the new subject (which gives you more context to the error).