You need to sign in to do that
Don't have an account?
Guru 91
Help with test class for batch apex?
Hi,
Help me with test class
public with sharing class CDP_Deal_BookmarkAfterUpdateHandler extends TriggerHandlerBase{
Map<Id, CDP_Deal_Bookmark__c> qualifiedBookmarks;
public override void qualifyStartingRecords(List<sObject> newList, List<sObject> oldList, Map<ID, sObject> newMap, Map<ID, sObject> oldMap) {
// everything qualifies for the CDPService.createFieldTrackingFeeds method
CDPService.createFieldTrackingFeeds(newMap, oldMap, 'Deal__c', true);
}
public override void start() {
}
public override void finish(boolean fromStart){}
}
Help me with test class
public with sharing class CDP_Deal_BookmarkAfterUpdateHandler extends TriggerHandlerBase{
Map<Id, CDP_Deal_Bookmark__c> qualifiedBookmarks;
public override void qualifyStartingRecords(List<sObject> newList, List<sObject> oldList, Map<ID, sObject> newMap, Map<ID, sObject> oldMap) {
// everything qualifies for the CDPService.createFieldTrackingFeeds method
CDPService.createFieldTrackingFeeds(newMap, oldMap, 'Deal__c', true);
}
public override void start() {
}
public override void finish(boolean fromStart){}
}
It covered Zero Percentage.
Here is my updated code
@isTest
public class CDP_Deal_BookmarkAfterUpdateHandlerTest {
@isTest static void check(){
CDP_Deal__c deal = new CDP_Deal__c();
deal.Name = 'Test Deal';
insert deal;
system.debug('------deal----'+deal.Id);
list<CDP_Deal_Bookmark__c> c=new list<CDP_Deal_Bookmark__c>();
for(integer i=0;i<200;i++){
CDP_Deal_Bookmark__c g=new CDP_Deal_Bookmark__c();
g.Deal__c=deal.Id;
c.add(g);
}
insert c;
Test.startTest();
CDP_Deal_BookmarkAfterUpdateHandler x = new CDP_Deal_BookmarkAfterUpdateHandler ();
Test.stopTest();
}
}