function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
randheer practiserandheer practise 

canany one help me that how to write a testclass ..to the below undelete class

it should cover both try aswell as catch also
public class UndeleteDml {
    public static void undeleteAccount()
    {
        List<Account> accounts=[SELECT id,Name FROM Account WHERE name like 'siri rao' all rows];
        system.debug('No of undeleted records are============'+accounts.size());
        try{
            undelete accounts;
            system.debug('No of records in Account============'+accounts);
            system.debug('records were undeleted from recyle bin successfully');
           }catch(Exception e){
                system.debug('sorry records were not undeleted');
               }
    }
}
thanks in advance