withHelpOnFailureBasedOnDefinedSubject

Option to create a DescriptiveAssertion like assertion with an additional hint which is based on the subject of the expectation and which is only shown if the subject is defined (and optionally based on a given showOnlyIf predicate).

You can use withHelpOnFailureBasedOnSubject in case you want to:

  • provide a hint also if the subject is absent.

  • show the hint even if the subject is absent.

Or use withHelpOnFailure which does not expect an Expect in case your DescriptiveAssertion is not based on the subject of the expectation.

Parameters

expect

The Expect from which the subject is taken to check if it is defined or not

failureHintFactory

The factory which creates the failure hint as such in the form of an Assertion.