+ 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