You need to sign in to do that
Don't have an account?
randheer practise
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
how to write test class to the undelete class with 100 coverage including try catch blocks
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
You can just create a account with name like 'siri rao' and by invoking the above class static method in Test Class, the code will be covered.
Please find below Test Class for your above Class:
Let us know if that helps you. Appreciate your response.
Best Regards,
BALAJI