Skip to content

Add OptionalAssert.hasValueMatching(Predicate<T>) #3848

@odrotbohm

Description

@odrotbohm

Feature summary

An ObjectAssert exposes matches(…) methods taking predicates. It would be useful to use boolean methods on Optional values as well.

Example

Optional<Person> optional = …

assertThat(optional).hasValueMatching(Person::isAdult);

Optionally (pun intended), also add an overload taking a descriptions, similarly to the matches(…) ones.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions