@isTest private class LexInvalidDelegationControllerTest { public static String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); public static String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId(); public static String leadNR = Schema.SObjectType.Lead.getRecordTypeInfosByDeveloperName().get('NewDaily_Report').getRecordTypeId(); public static String rectAg = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); static testMethod void testMethod1() { Task t1 = new Task( Subject = 'test_task', Status = '未着手', Priority = '中' ); insert new Task[] {t1}; Account testRectcoAccounts = new Account(Name = 'testRectcoAccount', RecordTypeId =Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId()); insert testRectcoAccounts; Account testRectHpAccounts = new Account(Name = 'testRectHpAccount', RecordTypeId = rectCo, Hospital__c = testRectcoAccounts.id); insert testRectHpAccounts; Contact testContacts = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber',RecordTypeId = rectAg, AWS_Data_Id__c = 'TestContact', accountId = testRectHpAccounts.id); insert testContacts; Lead testLeads = new Lead(LastName='testLead', Company='testLead',RecordTypeId = leadNR, Hospital_Name__c = testRectHpAccounts.id, Contact_Name__c = testContacts.Id); insert testLeads; QuoteIrai__c irai = new QuoteIrai__c(); irai.IraiSubject__c = '委托01'; irai.IraiUser__c = null; irai.CurrencyIsoCode = 'USD'; insert irai; LexInvalidDelegationController c= new LexInvalidDelegationController(); LexInvalidDelegationController.init(t1.Id); LexInvalidDelegationController.getQuoteIraic(t1.Id); LexInvalidDelegationController.updateLead(testLeads.Id,irai.Id,''); LexInvalidDelegationController.updateLead(t1.Id,'dd','dds'); LexInvalidDelegationController.updateQuoteIraic(irai.Id,'未着手'); LexInvalidDelegationController.updateQuoteIraic(t1.Id,'da'); LexInvalidDelegationController.updateTask(t1.Id,'未着手'); LexInvalidDelegationController.updateTask('t1.Id','未着手'); LexInvalidDelegationController.getProfileId(); } }