You need to sign in to do that
Don't have an account?
How to get Test Coverage for Database.emptyRecycleBin
I m not able to get the Test Coverage for only Database.emptyRecycleBin in my Test class
Below is my code snippet where i am not able to get coverage in my Apex Class
global void execute(Database.BatchableContext BC, list<Application__c > scope){
delete scope;
DataBase.emptyRecycleBin(scope);
}
Below is my Test Class:
@isTest(SeeAllData=true)
public class RS_PurgeRecycleBinApplicationTest
{
static testMethod void RS_PurgeRecycleBin()
{
test.StartTest();
Application__c app=new Application__c();
app.Application_Status__c='Paper';
app.GUID__c='1111';
Insert app;
List <Application__c> delApp=new List<Application__c>([Select Id from Application__c where GUID__c='1111']);
Delete delapp;
test.StopTest();
RS_PurgeRecycleBinApplication batchtest=new RS_PurgeRecycleBinApplication();
Database.executeBatch(batchtest);
RS_PurgeRecycleBinApplication schedulebatch=new RS_PurgeRecycleBinApplication();
String cronExp = '0 15 0 * * ? 2099';
String jobId = System.schedule('testRS_Scheduled', cronExp, schedulebatch);
}
}
Below is my code snippet where i am not able to get coverage in my Apex Class
global void execute(Database.BatchableContext BC, list<Application__c > scope){
delete scope;
DataBase.emptyRecycleBin(scope);
}
Below is my Test Class:
@isTest(SeeAllData=true)
public class RS_PurgeRecycleBinApplicationTest
{
static testMethod void RS_PurgeRecycleBin()
{
test.StartTest();
Application__c app=new Application__c();
app.Application_Status__c='Paper';
app.GUID__c='1111';
Insert app;
List <Application__c> delApp=new List<Application__c>([Select Id from Application__c where GUID__c='1111']);
Delete delapp;
test.StopTest();
RS_PurgeRecycleBinApplication batchtest=new RS_PurgeRecycleBinApplication();
Database.executeBatch(batchtest);
RS_PurgeRecycleBinApplication schedulebatch=new RS_PurgeRecycleBinApplication();
String cronExp = '0 15 0 * * ? 2099';
String jobId = System.schedule('testRS_Scheduled', cronExp, schedulebatch);
}
}
http://salesforce.stackexchange.com/questions/27180/database-emptyrecyclebin-exhibits-unexpected-behaviour
Make sure you Application__c data should be according to you Start Method Query so that your execute method will call