Hamcrest Quick Start: Enhanced JUnit syntax and capabilities

Learn how to use Hamcrest to make your JUnit tests easier to read and write.
Rating: 4.5 out of 5 (4 ratings)
1,255 students
English [Auto]
How to use Hamcrest to make unit tests more expressive
How to use Hamcrest to increase unit testing capability
How to use Hamcrest to ease unit testing development
How to write and run custom Hamcrest matchers


  • Basic abilities with Java and Junit.
  • Basic abilities with an IDE.


JUnit is one of Java's most popular unit testing frameworks.  Hamcrest is an additional layer that sits on top of JUnit, and it allows you to write expressive and developer-friendly unit tests.  In this course, you will learn which imports to use, how to write and run Hamcrest tests, how to use Hamcrest's fundamental methods, and how to write your own custom Hamcrest matchers.  No prior knowledge of Hamcrest is necessary. The course is example-driven instruction and includes guided practice and quizzes to strengthen your understanding. Basic knowledge of Java programming and JUnit is required.

Who this course is for:

  • Developers looking to add Hamcrest into their unit testing
  • Students wishing to learn Hamcrest
  • Academics wishing to learn development tools used in industry
  • Software team leaders looking to evaluate Hamcrest as a development tool

Course content

5 sections • 18 lectures • 44m total length
  • Hamcrest source code.
  • Introduction
  • assertThat(), equalTo() methods
  • String methods
  • Number methods
  • Expressive syntax
  • Matcher practice 1
  • Matcher practice 2
  • Quiz 1
    5 questions


Computer systems developer, educator
Craig Hawkins
  • 4.4 Instructor Rating
  • 420 Reviews
  • 7,603 Students
  • 4 Courses

Craig Hawkins is a native English speaker and professional systems developer. He holds a master's degree in Computer Science from Brown University, where he earned a straight-A average and worked as a teaching assistant.  Craig has worked as a systems developer in Norway and as a full stack developer in the United States. Additionally, Craig has nine years of full-time, licensed classroom teaching experience, where he has a track record of significantly raising measured student achievement.  When taking one of his courses, you can be assured of his strength in the subject, the effectiveness of his communication, and his ability to structure and deliver a quality learning experience.