Introduction
The @Test annotation tells JUnit which methods are test cases. It helps run tests automatically without manual calls.
When you want to check if a method in your code works correctly.
When you want to run multiple tests automatically in one go.
When you want to mark a method as a test so JUnit can report pass or fail.
When you want to organize your tests clearly in your test class.
When you want to use assertions inside a method to verify expected results.