1
vote
Test Code Coverage - Delete DML catch block
You can use the Test.isRunningTest method to check if the code is running in a test context and then throw a custom exception.
For example, you can modify your main class code like this:
@AuraEnabled
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
apextestrunresult × 53apex × 46
code-coverage × 15
unit-test × 10
failing-tests × 7
scheduled-apex × 3
salesforcedx × 2
deployment × 2
salesforcedx-cli × 2
try-catch × 2
trigger × 1
soql × 1
integration × 1
json × 1
callout × 1
picklist × 1
error × 1
sandbox × 1
appexchange × 1
controller-extension × 1
tooling-api × 1
change-set × 1
debugging × 1
email2case × 1
code × 1