Home

 

JUnit fundamentals

A unit test is a collection of tests designed to verify the behavior of a single unit.
A unit is always the smallest testable part of an application. In object-oriented programming, the smallest unit is always a class.

JUnit tests your class by scenario, and you have to create a testing scenario that uses the following elements:

Instantiate an object

Invoke methods

Verify assertions

Note: An assertion is a statement that allows you to test the validity of any assumptions made in your code.

ibm.com/redbooks