how to do unit testing code example

Example 1: what is unit testing

UNIT TESTING is a  software testing where individual
units or components of a software are tested.
The purpose is to validate that each unit of the 
software performs as designed.

Example 2: Unit Testing

It is part of the white box testing.
It’s done by the developers before 
they deploy the code from Development 
environment to QA environment. 
• Since it is performed by developers, 
I have never done unit testing yet. 
But I think I can learn it and do it if it is needed