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.
Downloads
You can obtain Hamcrest binaries from maven central, or from google code downloads.
Binaries
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.
Extensions
For Hamcrest extension projects see the hamcrest extensions page.
Dependencies
All libraries in the lib directory are used at build time, or are optional extras used for tighter integration with third party libraries.
ALL OF THE DEPENDENCIES ARE OPTIONAL.
Documentation
Documentation can be found on the google code wiki.
Reporting Bugs/Issues
If you find an issue with Java Hamcrest, please report it via the GitHub issue tracker, after first checking that it hasn't been raised already. N.B. a few issues are still tracked using the old google code Issue tracker.
Source
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
Acknowledgements
Developers:
- Joe Walnes
- Nat Pryce
- Steve Freeman
Contributors:
- 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.

