Skip to content

You should be able to specify a lambda to return a reason #354

Open

Description

@rjmunro

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)
);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions