1

i'm working on a test class and its giving a false positive. i wish to assert the result of the method being tested to see what the failure message is.

my test class ends with this

Test.startTest();
LifeLargeCaseReviewCtrl.createLLCRCase(caseObj, policyList, propObj, cdl.Id);
Test.stopTest(); 

how can i gather the return value of createLLCRCase() and write an assertion against it to get the message?

  • What is the data type of the return of LifeLargeCaseReviewCtrl.createLLCRCase() ? – Mark Pond Nov 5 '20 at 20:50
2

Based on your other question here: can't seem to get proper code coverage. any ideas? your method returns a string.

Test.startTest();
String returnData = LifeLargeCaseReviewCtrl.createLLCRCase(caseObj, policyList, propObj, cdl.Id);
Test.stopTest();
System.assertEquals('Success', returnData, 'Case was not able to be created.');
  • perfect, thank you! – sfn00b Nov 5 '20 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.