@isTest
|
private class UpdateHospitalOppDateBatchTest {
|
|
@isTest static void test_method_one() {
|
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
|
if (rectCo.size() == 0) {
|
return;
|
}
|
|
Account company = new Account();
|
company.RecordTypeId = rectCo[0].Id;
|
company.Name = 'NFM007TestCompany';
|
upsert company;
|
RecordType[] rt = [select Id from RecordType where SobjectType = 'Opportunity' and IsActive = true and DeveloperName = 'Target'];
|
list<Opportunity> Opportunities = new list<Opportunity>();
|
Opportunity newopp = new Opportunity();
|
newopp.Name = 'test01' ;
|
newopp.StageName = '目標';
|
newopp.Hospital__c = company.id;
|
newopp.RecordTypeId = rt[0].ID;
|
newopp.CloseDate = Date.today();
|
|
upsert newopp;
|
Statu_Achievements__c Sac = new Statu_Achievements__c(
|
name = 'zhucan_one',
|
Opportunity__c = newopp.id,
|
DeliveryDate__c = Date.today(),
|
ContractNO__c = 'ContractNO1',
|
ContractAmount__c = 1
|
);
|
insert Sac;
|
|
Id execBTId = Database.executeBatch(new UpdateHospitalOppDateBatch(company.id), 100);
|
execBTId = Database.executeBatch(new UpdateHospitalOppDateBatch(), 100);
|
}
|
|
}
|