@isTest
|
public class NFM201ControllerTest {
|
|
static testMethod void myUnitTest(){
|
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
|
if (rectCo.size() == 0) {
|
return;
|
}
|
List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科'];
|
if (rectSct.size() == 0) {
|
return;
|
}
|
List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
|
if (rectDpt.size() == 0) {
|
return;
|
}
|
NFM001Controller.isRunning = true;
|
// テストデータ
|
Account company = new Account();
|
company.RecordTypeId = rectCo[0].Id;
|
company.Name = 'NFM007TestCompany';
|
upsert company;
|
Account section = new Account();
|
section.RecordTypeId = rectSct[0].Id;
|
section.Name = '*';
|
section.Department_Class_Label__c = '消化科';
|
section.ParentId = company.Id;
|
section.Hospital_Department_Class__c = company.Id;
|
upsert section;
|
Account depart = new Account();
|
depart.RecordTypeId = rectDpt[0].Id;
|
depart.Name = '*';
|
depart.Department_Name__c = 'NFM007TestDepart';
|
depart.ParentId = section.Id;
|
depart.Department_Class__c = section.Id;
|
depart.Hospital__c = company.Id;
|
upsert depart;
|
|
BatchIF_Log__c BIlog = new BatchIF_Log__c();
|
//BIlog.Name = '20170001431511';
|
BIlog.ErrorLog__c = 'userID is null';
|
BIlog.Log__c = 'DB800712';
|
insert BIlog;
|
|
BatchIF_Transfer__c BItransfer = new BatchIF_Transfer__c();
|
BItransfer.Table__c = 'Account';//表
|
BItransfer.Column__c = 'OCM_Category__c';//项目
|
BItransfer.External_Value__c = 'NORMAL';//外部值
|
BItransfer.Internal_Value__c = '一般';//内部值
|
BItransfer.Dropped_Flag__c = false;//是否无效
|
insert BItransfer;
|
|
Test.startTest();
|
//NFM201Controller controller = new NFM201Controller();
|
List<String> accIds = new List<String>();
|
accIds.add(company.ID);
|
Map<String,String> purposeOfAdviceMap = new Map<String,String>();
|
purposeOfAdviceMap.put(BIlog.ID,'病理');
|
Map<String,String> needSendRectMap = new Map<String,String>();
|
needSendRectMap.put(company.RecordTypeId,'病院');
|
Map<String,String> needQuolifiedMap = new Map<String,String>();
|
String TestID = '9A00901';
|
String TestID01 = '';
|
NFM201Controller.callout(BIlog.ID,accIds,purposeOfAdviceMap,needSendRectMap,needQuolifiedMap);
|
NFM201Controller.callout(TestID,accIds,purposeOfAdviceMap,needSendRectMap,needQuolifiedMap);
|
NFM201Controller.callout(TestID01,accIds,purposeOfAdviceMap,needSendRectMap,needQuolifiedMap);
|
Test.stopTest();
|
}
|
}
|