@IsTest
|
class LexNewAndEditContactPIPLControllerTest {
|
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 rectOffice = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('office').getRecordTypeId();
|
public static String rectAg = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
|
public static String rectIs = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Internal_staff').getRecordTypeId();
|
public static List<Contact> contList;
|
@testSetup
|
static void testSetup() {
|
Account testRectcoAccounts = new Account(Name = 'testRectcoAccount', RecordTypeId = rectHp,Is_Active__c = '有効');
|
insert testRectcoAccounts;
|
Account testRectHpAccounts = new Account(Name = 'testRectHpAccount', RecordTypeId = rectCo, Hospital__c = testRectcoAccounts.id,Is_Active__c = '有効');
|
insert testRectHpAccounts;
|
Account testRectOfficeAccounts = new Account(Name = 'testRectOfficeAccounts', RecordTypeId = rectOffice);
|
insert testRectOfficeAccounts;
|
Contact testRectAgContacts = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='testRectAgContacts',RecordTypeId = rectAg, AWS_Data_Id__c = 'TestContact', accountId = testRectcoAccounts.id);
|
insert testRectAgContacts;
|
Contact testRectIsContacts = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='testRectIsContacts',RecordTypeId = rectIs, accountId = testRectHpAccounts.Id);
|
insert testRectIsContacts;
|
contList = new List<Contact>();
|
contList.add(testRectAgContacts);
|
contList.add(testRectIsContacts);
|
}
|
@isTest
|
static void testInitDataMethod1(){
|
Account acctRectHp = [SELECT Id,Name FROM Account WHERE Name='testRectcoAccount' LIMIT 1];
|
Account acctRectCo = [SELECT Id,Name FROM Account WHERE Name='testRectHpAccount' LIMIT 1];
|
Contact contRectAg = [SELECT Id,RecordTypeId,accountId FROM Contact WHERE LastName = 'testRectAgContacts' LIMIT 1];
|
Contact contRectIs = [SELECT Id,RecordTypeId,accountId FROM Contact WHERE LastName = 'testRectIsContacts' LIMIT 1];
|
System.Test.startTest();
|
LexNewAndEditContactPIPLController.initData(contRectAg.Id,rectAg,'Contact',contRectAg.accountId);
|
LexNewAndEditContactPIPLController.initData(contRectIs.Id,null,'Contact',contRectIs.accountId);
|
LexNewAndEditContactPIPLController.initData(contRectAg.Id,null,'Contact',null);
|
LexNewAndEditContactPIPLController.searchContactByAccountId(contRectAg.accountId,rectAg,'有效');
|
// LexNewAndEditContactPIPLController.searchContactByAccountId('',rectAg,'有效');
|
LexNewAndEditContactPIPLController.ResponseV2 c2 = new LexNewAndEditContactPIPLController.ResponseV2();
|
c2.contactList = contList;
|
c2.accountName = acctRectHp.Name;
|
c2.dataIdManageCodeMap = null;
|
c2.isMobileVerif = True;
|
c2.isNameMobileVerif = True;
|
c2.message = null;
|
c2.status = 'success';
|
System.Test.stopTest();
|
}
|
}
|