Create a unit test for a simple Apex class
Install a simple Apex class, write unit tests that achieve 100% code coverage for the class, and run your Apex tests.
- The Apex class to test is called ‘VerifyDate’, and the code is available here. Copy and paste this class into your Developer Edition via the Developer Console.
- ‘VerifyDate’ is a class which tests if a date is within a proper range, and if not will return a date that occurs at the end of the month within the range.
- The unit tests must be in a separate test class called ‘TestVerifyDate’.
- The unit tests must cover scenarios for all lines of code included in the Apex class, resulting in 100% code coverage.
- Run your test class at least once (via ‘Run All’ tests the Developer Console) before attempting to verify this challenge.