Skip to main content

A very simple JUnit5 test

 A very simple JUnit test would be a case where we are testing a method or a class that has no dependency on any other class.

For example below is a simple calculator class that calculates sum of two numbers.

To write a unit test for this method, we simply call the add method and verify the response.

This test does not require any use of Mockito framework and can be created by using just the JUnit framework.