
You will need to download and install Hamcrest for Java:
https://github.com/hamcrest/JavaHamcrest
After watching this video, students will understand the advantages of using Hamcrest, and the requirements for the course.
Explore Hamcrest's assertThat and equalTo methods to express assertions, verify a string length equals three, and use an optional custom error message with imports.
Explore Hamcrest number methods for numeric assertions, using integers with less than, less than or equal to, equal to, greater than or equal to, and greater than, and floating-point checks within plus or minus delta.
Practice writing Hamcrest matchers to verify ride eligibility using a Person class with age and height, creating tests for eligible and not eligible, based on 10 and 48 inches.
Learn to implement a custom Hamcrest starts with matcher for strings, using a type safe matcher, and validate case sensitivity with practical tests like Apple and banana.
Explore Hamcrest methods for Java beans, using hasProperty, equalTo, samePropertyValuesAs, and not to verify bean fields such as name and number in a football player example.
Conclude your Hamcrest quick start by understanding how Hamcrest works, using its methods, and writing custom matches, then apply these skills to your own projects.
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.