@isTest private class ASOTDeleteRealBatchTest { static testMethod void testMethod1() { ASOTDeleteRealBatch batch3 = new ASOTDeleteRealBatch(); Database.executeBatch(batch3,200); } @testSetup private static void setUpDate(){ List asotL = new List(); Date toDayTime = Date.today(); Account hospital = new Account(); hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id; hospital.Name = 'hospitalabc'; hospital.Is_Active__c = '有効'; hospital.Attribute_Type__c = '卫生部'; hospital.Speciality_Type__c = '综合医院'; hospital.Grade__c = '一级'; hospital.IF_Coverage_Target_HP__c = '1'; hospital.OCM_Category__c = 'SLTV'; hospital.Is_Medical__c = '医疗机构'; hospital.Town__c = '东京'; Oly_TriggerHandler.bypass('NFM701ControllerHandler'); Oly_TriggerHandler.bypass('UpdateContractAimAmountHandler'); insert hospital; Account_Service_Of_Target__c asot1 = new Account_Service_Of_Target__c(); asot1.Renew_Finish_Else__c = 10; asot1.Renew_Finish_Correlation_Lightsource__c = 10; asot1.Renew_Finish_Rigid_Mirror_3__c = 10; asot1.Renew_Finish_Rigid_Mirror_1__c = 10; asot1.Finish_Correlation_Lightsource__c = 10; asot1.Finish_Rigid_Mirror_2__c = 10; asot1.Finish_Rigid_Mirror_1__c = 10; asot1.Account_HP__c=hospital.Id; asotL.add(asot1); Account_Service_Of_Target__c asot2 = new Account_Service_Of_Target__c(); asot2.Renew_Finish_Else__c = 10; asot2.Renew_Finish_Correlation_Lightsource__c = 10; asot2.Renew_Finish_Rigid_Mirror_3__c = 10; asot2.Renew_Finish_Rigid_Mirror_1__c = 10; asot2.Finish_Correlation_Lightsource__c = 10; asot2.Finish_Rigid_Mirror_2__c = 10; asot2.Finish_Rigid_Mirror_1__c = 10; asot2.Account_HP__c=hospital.Id; asotL.add(asot2); Account_Service_Of_Target__c asot3 = new Account_Service_Of_Target__c(); asot3.Renew_Finish_Else__c = 10; asot3.Renew_Finish_Correlation_Lightsource__c = 10; asot3.Renew_Finish_Rigid_Mirror_3__c = 10; asot3.Renew_Finish_Rigid_Mirror_1__c = 10; asot3.Finish_Correlation_Lightsource__c = 10; asot3.Finish_Rigid_Mirror_2__c = 10; asot3.Finish_Rigid_Mirror_1__c = 10; asot3.Account_HP__c=hospital.Id; asotL.add(asot3); insert asotL; } }