dmfs / jems

Java gems, a collection of Java utilities.
Apache License 2.0
5 stars 2 forks source link

FunctionMatcher #255

Closed dmfs closed 4 years ago

dmfs commented 4 years ago

A Matcher for functional interfaces.

At present we can match functional interfaces only by using the having matcher. A dedicated FunctionMatcher could simplify these cases:

assertThat(squareFunction, having(f->f.value(10), equalTo(100)));
// vs.
assertThat(squareFunction, evaluates(10, equalTo(100)));
dmfs commented 4 years ago

done