Increasing Code Coverage to Include Catch Blocks [Salesforce]

In Salesforce, it can sometimes be frustrating driving your Apex Class & Trigger Code Coverage up to get beyond the 75%, 80%, or 85%+ marks.  Some of the more difficult parts of that process can be covering all scenarios to achieve this. In particular, this post focuses on code not executed within the try-catch constructs count against the overall Code Coverage calculations. With a simple refactor, we can remedy that without changing the underlying functionality of the core class — just the test class. The try-catch we will start with before our changes have the following format: try { // … Read More