lambda-matcher

Create Hamcrest Matchers with Java 8 method references and lambdas.

License

License

GroupId

GroupId

name.falgout.jeffrey.testing
ArtifactId

ArtifactId

lambda-matcher
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

lambda-matcher
Create Hamcrest Matchers with Java 8 method references and lambdas.
Project URL

Project URL

https://github.com/JeffreyFalgout/lambda-matcher
Source Code Management

Source Code Management

https://github.com/JeffreyFalgout/lambda-matcher

Download lambda-matcher

How to add to project

<!-- https://jarcasting.com/artifacts/name.falgout.jeffrey.testing/lambda-matcher/ -->
<dependency>
    <groupId>name.falgout.jeffrey.testing</groupId>
    <artifactId>lambda-matcher</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/name.falgout.jeffrey.testing/lambda-matcher/
implementation 'name.falgout.jeffrey.testing:lambda-matcher:0.2.0'
// https://jarcasting.com/artifacts/name.falgout.jeffrey.testing/lambda-matcher/
implementation ("name.falgout.jeffrey.testing:lambda-matcher:0.2.0")
'name.falgout.jeffrey.testing:lambda-matcher:jar:0.2.0'
<dependency org="name.falgout.jeffrey.testing" name="lambda-matcher" rev="0.2.0">
  <artifact name="lambda-matcher" type="jar" />
</dependency>
@Grapes(
@Grab(group='name.falgout.jeffrey.testing', module='lambda-matcher', version='0.2.0')
)
libraryDependencies += "name.falgout.jeffrey.testing" % "lambda-matcher" % "0.2.0"
[name.falgout.jeffrey.testing/lambda-matcher "0.2.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.hamcrest : hamcrest-core jar 1.3

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
com.google.truth : truth jar 0.30

Project Modules

There are no modules declared in this project.

lambda-matcher

Create Hamcrest Matchers with Java 8 method references and lambdas.

Maven Central

An alternative to FeatureMatcher. Instead of implementing a new class, just call one of the static factory methods in LambdaMatcher. For instance, if you wanted to create a matcher on a Throwable's message:

  Throwable t = new Throwable("foobar");

  @Test
  public void test() {
    assertThat(t, hasMessage(containsString("foo")));
  }
  
  public static Matcher<? super Throwable> hasMessage(Matcher<? super String> matcher) {
  	return LambdaMatcher.createMatcher(Throwable::getMessage, matcher);
  }

Versions

Version
0.2.0
0.1.0