Unit Testing Java Programs Using JUnit5 and Mockito


What are Unit Tests?

In Unit Tests, we test the a unit - the smallest piece of logical code, in a program. Generally this unit is an individual method of a class. 


Junit Framework?

JUnit framework allows us to write and run unit tests. As per official JUnit documentation,

JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.


Mockito Framework?

Mockito is an open source testing framework for Java released under the MIT License. Mockito helps us to create dummy implementation for an interface or a class. In a dummy implementation we can define behaviour of a method to support our test requirements. Mockito works in conjunction with JUnit and allows us to create repeatable automated tests.


Tutorials.