Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global String query;
- global my_ProcessPurge_Batch() {
- //initialize query string here
- }
- global Database.QueryLocator start(Database.BatchableContext BC) {
- return Database.getQueryLocator(query);
- }
- global void execute(Database.BatchableContext BC, List<sObject> scope) {
- //some DML statements here
- }
- global void finish(Database.BatchableContext BC) {
- //send email of the result
- //schedule next batch
- my_ProcessPurge_Batch nextBatch = new my_ProcessPurge_Batch();
- //job should start executing after 24 hrs
- //scope is 1000
- System.scheduleBatch(nextBatch, 'my_ProcessPurge_Batch', 1440, 1000);
- }
- @isTest static void testProcessPurge() {
- Test.startTest();
- //populate test data
- //start batch
- my_ProcessPurge_Batch purgeBatch = new my_ProcessPurge_Batch();
- database.executeBatch(purgeBatch);
- Test.stopTest();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement