You should be able to specify a lambda to return a reason
rjmunro opened this issue · comments
It would be good if I can specify a reason as a lambda:
That way it can be evaluated only if it fails, and it can be passed the result of the evaluation without needing to call it again.
You could then do something like:
assertThat(
(list) -> String.format("List is not empty, last item is %s", list.get(list.size() - 1)),
somethingThatReturnsAList(),
hasLength(0)
);