Luigi Libero Lucio Starace, Ph.D.

Assistant Professor @ Università degli Studi di Napoli Federico II, Italy.

Unit Testing with JUnit 5, Hamcrest, and Mockito

[Slides]

Abstract

These slides go over the topic of Unit Testing, focusing on the qualities that make unit tests good (clean). Firstly, the JUnit 5 Unit Testing framework is presented in detail. Then, the challenge of writing effective assertions is considered, and the well-known matching library Hamcrest is introduced, with many practical examples. At last, the slides discuss the issue of testing software components with dependencies in isolation, and the key concepts of test doubles, inversion of control, and the mocking library Mockito are introduced.