+ Start a Discussion
Nidhi MeshramNidhi Meshram 

how to cover empty method in a test class

Trigger having all the events so in handler there are two methods which i not able to cover how to cover this methods:-

public void afterDelete(SObject so) {
    }
    
    public void afterUndelete(SObject so) {
    }
Best Answer chosen by Nidhi Meshram
Steve Schreiner 4Steve Schreiner 4
Remove the unused events from the trigger. Why have them if never used?

All Answers

dinesh abcdinesh abc
your calling this two methods in your test class
dinesh abcdinesh abc
possible you can share your test class
Prachi Goel 17Prachi Goel 17
Hi ,@Nidhi Meshram
You can do like this:
ClassName.afterDelete(Pass object name here);
ClassName.afterUndelete(Pass Object name here);
Steve Schreiner 4Steve Schreiner 4
Remove the unused events from the trigger. Why have them if never used?
This was selected as the best answer
rohit singh 210rohit singh 210
Because of limited resources, it does not count as DML. 
check here the best collection of lord shiva quotes (https://www.statusvideosguru.com/2019/12/lord-shiva-quotes-status.html)
rohit singh 210rohit singh 210
<a href="https://www.statusvideosguru.com/2019/12/lord-shiva-quotes-status.html">lord shiva quotes</a>
Hin ChHin Ch
I have been struggling with this problem for some days, please give someone a best solution to it.
Regard,  (https://packagespoint.com)
Rohan sharma 54Rohan sharma 54
Armed with an experience of many decades, the company’s R&D division is consistently dedicated to produce new age products. Sakarni Power Putty being one of those products is prepared with an international grade of formulation where quality https://sakarni.com/wall-putty/ is of paramount at every step beginning with the detailed selection to the procurement of the raw material and delivery of the end product at the doorstep. In Sakarni Power Putty white cement, 
Rohan sharma 54Rohan sharma 54

Armed with an experience of many decades, the company’s R&D division is consistently dedicated to produce new age products. Sakarni Power Putty being one of those products is prepared with an international grade of formulation where quality wall putty (https://sakarni.com/wall-putty/ i) is of paramount at every step beginning with the detailed selection to the procurement of the raw material and delivery of the end product at the doorstep. In Sakarni Power Putty white cement, 
Muhammad SajjadMuhammad Sajjad
To cover the catch part of your class you have to throw some exceptions in your test class.
As we are not aware of your data model and validations so we can't suggest anything on what error should be thrown in your test class.
My Test on: https://seotoolcheckers.com/
Rohan sharma 68Rohan sharma 68
Because of limited resources 
if you like Shayari and feeling sad check out here the collection latest sad Shayari with images (https://shayariaboutlove.co/sad-shayari-with-images/) in Hindi