Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Hamcrest Quick Start: Enhanced JUnit syntax and capabilities
Rating: 4.5 out of 5(28 ratings)
2,134 students

Hamcrest Quick Start: Enhanced JUnit syntax and capabilities

Learn how to use Hamcrest to make your JUnit tests easier to read and write.
Created byCraig Hawkins
Last updated 9/2020
English
English [Auto],

What you'll learn

  • 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

Course content

5 sections18 lectures44m total length
  • Hamcrest source code.0:03

    You will need to download and install Hamcrest for Java:

    https://github.com/hamcrest/JavaHamcrest

  • Introduction0:49

    After watching this video, students will understand the advantages of using Hamcrest, and the requirements for the course.

  • assertThat(), equalTo() methods2:07

    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.

  • String methods2:33
  • Number methods2:50

    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.

  • Expressive syntax1:33
  • Matcher practice 12:49

    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.

  • Matcher practice 21:58
  • Quiz 1

Requirements

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

Description

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