A test class is the only class in Apex that can have a private access modifier. It always runs when you want to deploy any Apex code to a production environment using the default tests, or when you create a managed package. Due to the fact that unit tests, in principle, are not called from outside the class, you can define your test class with the private access modifier.
A test class is always written with the @IsTest annotation. In this type of class, you are able to define regular methods and test methods. For instance, if you want to create your test data in one method and run this method in each unit test, you are able to create a regular method in your test class where you create your data. The unit tests (methods to test your implementation code) are written in test methods. You are able to define your test methods in two ways:
- The method has the...