JavaHamcrest icon indicating copy to clipboard operation
JavaHamcrest copied to clipboard

FeatureMatcher factory method for java 8 users

Open leaumar opened this issue 7 years ago • 2 comments

This simple addition allows users on java 8 to do this:

FeatureMatcher.ofFunction(Thing::calculateName, containsString("foo"), "calculated name contains foo", "calculateName")

instead of

new FeatureMatcher(containsString("foo"), "calculated name contains foo", "calculateName") {
  @Override
  protected String featureValueOf(Thing actual) {
    return actual.calculateName();
  }
}

Less verbose/more concise, more pleasant to work with, and does not require hamcrest to be updated to java 8 or anything.

leaumar avatar May 16 '18 18:05 leaumar

@leaumar looking at getting java 8, 11 and newer support into hamcrest, please can you rebase from master, as hamcrest-core and hamcrest-library have been refactored a lot and also deprecated, so that everything is just in hamcrest.

nhojpatrick avatar Jun 29 '20 18:06 nhojpatrick

Going to try and kick start hamcrest, so if you want to get it merged, please rebase from the branch feature/v3.x-ea. Still trying to understand how has permissions to perform a release. Looking to keep v2.x as java 7, with v3 bumping to java 8.

nhojpatrick avatar Feb 13 '22 12:02 nhojpatrick