Hamcrest Matchers Library

Library of additional matchers for Hamcrest

License

License

GroupId

GroupId

com.btmatthews.hamcrest
ArtifactId

ArtifactId

hamcrest-matchers
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Hamcrest Matchers Library
Library of additional matchers for Hamcrest
Project URL

Project URL

https://github.com/bmatthews68/hamcrest-matchers
Project Organization

Project Organization

Brian Matthews
Source Code Management

Source Code Management

https://github.com/bmatthews68/hamcrest-matchers

Download hamcrest-matchers

How to add to project

<!-- https://jarcasting.com/artifacts/com.btmatthews.hamcrest/hamcrest-matchers/ -->
<dependency>
    <groupId>com.btmatthews.hamcrest</groupId>
    <artifactId>hamcrest-matchers</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.btmatthews.hamcrest/hamcrest-matchers/
implementation 'com.btmatthews.hamcrest:hamcrest-matchers:1.0.1'
// https://jarcasting.com/artifacts/com.btmatthews.hamcrest/hamcrest-matchers/
implementation ("com.btmatthews.hamcrest:hamcrest-matchers:1.0.1")
'com.btmatthews.hamcrest:hamcrest-matchers:jar:1.0.1'
<dependency org="com.btmatthews.hamcrest" name="hamcrest-matchers" rev="1.0.1">
  <artifact name="hamcrest-matchers" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.btmatthews.hamcrest', module='hamcrest-matchers', version='1.0.1')
)
libraryDependencies += "com.btmatthews.hamcrest" % "hamcrest-matchers" % "1.0.1"
[com.btmatthews.hamcrest/hamcrest-matchers "1.0.1"]

Dependencies

compile (1)

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

test (2)

Group / Artifact Type Version
org.mockito : mockito-core jar 1.9.5
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

Hamcrest Matchers Library

The Hamcrest Matchers Library provides additional Matcher implementations that work with Hamcrest for use in checking the results of operations being unit tested.

Pattern Matching

  • matches - tests that the value matches a regular expression
  • doesNotMatch - tests that a value does not match a regular expression
import static org.hamcrest.MatcherAssert.assertThat;
import static com.btmatthews.hamcrest.PatternMatcher.matches;

import org.junit.Test;

class TestPatternMatching {

  @Test
  public void idStringIsNumeric() {
    final Biscuit biscuit = new Biscuit("1234", "Custard Cream"));
    assertThat("id string is numeric", biscuit.getId(), matches("\\d+"));
  }
}

Maven Central Coordinates

The Hamcrest Matchers Library has been published in Maven Central at the following coordinates:

<dependency>
    <groupId>com.btmatthews.hamcrest</groupId>
    <artifactId>hamcrest-matchers</artifactId>
    <version>1.0.0</version>
    <scope>test</scope>
</dependency>

License & Source Code

The Hamcrest Matchers Library is made available under the Apache License and the source code is hosted on GitHub at https://github.com/bmatthews68/hamcrest-matchers.

Versions

Version
1.0.1
1.0.0