+ Start a Discussion
Miranda L 2Miranda L 2 

How to cover these code in my test class

I need help to cover following code into my test class
User-added imageUser-added imageUser-added image
You need to craft a test case that meets the criteria.  So you need to have a test method that returns the data that the SOQL query returns, data that fails your try statement, data that causes invoicesToUpdate to not be empty and oldInvoicesToUpdate to not be empty.  Looking at the failed lines here (with the exception of the catch block) it appears that you're not testing your code in a meaningful way.