What is the purpose of JUnit?

What is the purpose of JUnit?

We use JUnit testing in order to facilitate behaviour testing of different methods present inside those classes which are written by us. When we test any method for the results we expect, we might sometimes throw exception-throwing cases to check if the method can handle all the exceptions however we want it to.