i want to make test with this class, but i'm new with salesforce / Apex and i don't know what i do for it.
global class Batch_Update_account implements Database.Batchable<sObject>,Database.AllowsCallouts, Database.Stateful {
global Set<Id> ids;
global Batch_Update_account(Set<Id> accountIds) {
ids = accountIds;
}
global Database.QueryLocator start(Database.BatchableContext BC) {
String query = 'SELECT Id, N_Fiscal__c, AL_DUNS_Number_compagny__c FROM ACCOUNT WHERE Id IN :ids';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Account> scope) {
/*
datetime start = system.Now();
while(System.Now()<start.addSeconds(1)){}
*/
System.debug('execute Batch_Update_account');
DNB_Token token = new DNB_Token();
Account[] toDelete = new Account[]{};
Account[] toUpsert = new Account[]{};
for(Account ac : scope){
System.debug('Call of populateDuns');
AccountAction.populateDuns(ac,token);
/*
if(ac.Tech_IsWrong_Acct__c == true && ac.AL_DUNS_Number_compagny__c == null){
toDelete.add(ac);
} else {
toUpsert.add(ac);
}*/
}
//AccountAction.handleToDeleteAccount(toDelete);
upsert scope;
token.save();
}
global void finish(Database.BatchableContext BC) {
}
}