Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (59 sloc) 2.68 KB

Java Hamcrest

Licensed under BSD License.

What is Hamcrest?

Hamcrest is a library of matchers, which can be combined in to create flexible expressions of intent in tests.


You can obtain Hamcrest binaries from maven central, or from google code downloads.


Depending on how you intend to use Hamcrest, you should use different Jars.

  • hamcrest-core.jar -- This is the core API to be used by third-party framework providers. This includes the a foundation set of matcher implementations for common operations. This API is stable and will rarely change. You will need this library as a minimum.
  • hamcrest-library.jar -- The ever-growing library of Matcher implementations. This will grow between releases.
  • hamcrest-generator.jar -- A tool to allow many Matcher implementations to be combined into a single class so users don't have to remember many classes/packages to import. Generates code.
  • hamcrest-integration.jar -- Provides integration between Hamcrest and other testing tools, including JUnit (3 and 4), TestNG, jMock and EasyMock.

Alternatively, if you don't care:

  • hamcrest-all.jar -- Includes all of the above.

Sources and JavaDoc jars are available for all of the above.


All libraries in the lib directory are used at build time, or are optional extras used for tighter integration with third party libraries.



Documentation can be found on the google code wiki.


The complete source for Hamcrest is bundled. This includes:

  • Matcher core classes [src/core]
  • Matcher library [src/library]
  • Matcher integrations [src/integration]
  • Syntactic sugar generator [src/generator]
  • Unit tests [src/unit-test]
  • Ant build file [build.xml]
  • Dependencies [lib]

To build, please read BUILDING.txt



  • Joe Walnes
  • Nat Pryce
  • Steve Freeman


  • Robert Chatley
  • Tom White
  • Neil Dunn
  • Dan North
  • Magne Rasmussen
  • David Saff
  • Tom Denley

Also, thanks to everyone who has worked on DynaMock, nMock, jMock, EasyMock and MiniMock! These libraries inspired Hamcrest.

Jump to Line
Something went wrong with that request. Please try again.