From e6068da47c1bef5517c9e5fdc8c726766867ad4e Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 14 七月 2023 15:10:02 +0800 Subject: [PATCH] Merge branch 'master' into LEXUpgrade2023-Deloitte --- force-app/main/default/classes/LexLicenceReminderControllerTest.cls | 153 +++------------------------------------------------ 1 files changed, 9 insertions(+), 144 deletions(-) diff --git a/force-app/main/default/classes/LexLicenceReminderControllerTest.cls b/force-app/main/default/classes/LexLicenceReminderControllerTest.cls index 3c99e88..5e5fbec 100644 --- a/force-app/main/default/classes/LexLicenceReminderControllerTest.cls +++ b/force-app/main/default/classes/LexLicenceReminderControllerTest.cls @@ -1,57 +1,32 @@ @IsTest private class LexLicenceReminderControllerTest { @IsTest -<<<<<<< HEAD static void testMethod1() { -======= - static void testMethod1(){ ->>>>>>> LEXCommunityLiJun User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; LicenceReminderDate__c l = new LicenceReminderDate__c(Name = '180Days', ReminderDays__c = 180); insert l; Test.startTest(); -<<<<<<< HEAD System.runAs(currentUser) { -======= - System.runAs(currentUser){ ->>>>>>> LEXCommunityLiJun LexLicenceReminderController.initReminder(); } Test.stopTest(); } @IsTest -<<<<<<< HEAD static void testMethod2() { -======= - static void testMethod2(){ ->>>>>>> LEXCommunityLiJun Account myAccount1 = new Account(); Contact core = new Contact(); User myUser_test = new User(); User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; LicenceReminderDate__c l = new LicenceReminderDate__c(Name = '180Days', ReminderDays__c = 180); insert l; -<<<<<<< HEAD System.runAs(currentUser) { - Profile prof = [ - SELECT Id - FROM Profile - WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)' - ]; - List<RecordType> rectCo = [ - SELECT Id - FROM RecordType - WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�' - ]; + Profile prof = [SELECT Id FROM Profile WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)']; + List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�']; if (rectCo.size() == 0) { return; } - List<RecordType> rectHos = [ - SELECT Id - FROM RecordType - WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌' - ]; + List<RecordType> rectHos = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌']; if (rectHos.size() == 0) { return; } @@ -81,98 +56,26 @@ } Test.startTest(); System.runAs(myUser_test) { -======= - System.runAs(currentUser){ - Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)']; - List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�']; - if (rectCo.size() == 0) { - return; - } - List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌']; - if (rectHos.size() == 0) { - return; - } - - myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4,Test02|3|5' ,AgentCode_Ext__c = '9999900'); - insert myAccount1; - core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); - insert core; - myUser_test = new User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com'); - insert myUser_test; - } - Test.startTest(); - System.runAs(myUser_test){ LexLicenceReminderController.initReminder(); } Test.stopTest(); } @IsTest - static void testMethod3(){ - Account myAccount1 = new Account(); - Contact core = new Contact(); - User myUser_test = new User(); - User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; - LicenceReminderDate__c l = new LicenceReminderDate__c(Name = '180Days', ReminderDays__c = 180); - insert l; - System.runAs(currentUser){ - Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)']; - List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�']; - if (rectCo.size() == 0) { - return; - } - List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌']; - if (rectHos.size() == 0) { - return; - } - - myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4,Test02|3|5' ,AgentCode_Ext__c = '9999900',Medical_Equipment_Expiration_Date__c = Date.newInstance(2023, 6, 10)); - insert myAccount1; - core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); - insert core; - myUser_test = new User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com'); - insert myUser_test; - } - Test.startTest(); - System.runAs(myUser_test){ ->>>>>>> LEXCommunityLiJun - LexLicenceReminderController.initReminder(); - } - Test.stopTest(); - } - - @IsTest -<<<<<<< HEAD static void testMethod3() { -======= - static void testMethod4(){ ->>>>>>> LEXCommunityLiJun Account myAccount1 = new Account(); Contact core = new Contact(); User myUser_test = new User(); User currentUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; LicenceReminderDate__c l = new LicenceReminderDate__c(Name = '180Days', ReminderDays__c = 180); insert l; -<<<<<<< HEAD System.runAs(currentUser) { - Profile prof = [ - SELECT Id - FROM Profile - WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)' - ]; - List<RecordType> rectCo = [ - SELECT Id - FROM RecordType - WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�' - ]; + Profile prof = [SELECT Id FROM Profile WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)']; + List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�']; if (rectCo.size() == 0) { return; } - List<RecordType> rectHos = [ - SELECT Id - FROM RecordType - WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌' - ]; + List<RecordType> rectHos = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌']; if (rectHos.size() == 0) { return; } @@ -203,33 +106,10 @@ } Test.startTest(); System.runAs(myUser_test) { -======= - System.runAs(currentUser){ - Profile prof = [select Id from Profile where Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)']; - List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�']; - if (rectCo.size() == 0) { - return; - } - List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌']; - if (rectHos.size() == 0) { - return; - } - - myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4,Test02|3|5' ,AgentCode_Ext__c = '9999900',Medical_Equipment_Expiration_Date__c = Date.newInstance(2025, 6, 10)); - insert myAccount1; - core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); - insert core; - myUser_test = new User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com'); - insert myUser_test; - } - Test.startTest(); - System.runAs(myUser_test){ ->>>>>>> LEXCommunityLiJun LexLicenceReminderController.initReminder(); } Test.stopTest(); } -<<<<<<< HEAD @IsTest static void testMethod4() { @@ -240,24 +120,12 @@ LicenceReminderDate__c l = new LicenceReminderDate__c(Name = '180Days', ReminderDays__c = 180); insert l; System.runAs(currentUser) { - Profile prof = [ - SELECT Id - FROM Profile - WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)' - ]; - List<RecordType> rectCo = [ - SELECT Id - FROM RecordType - WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�' - ]; + Profile prof = [SELECT Id FROM Profile WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)']; + List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�']; if (rectCo.size() == 0) { return; } - List<RecordType> rectHos = [ - SELECT Id - FROM RecordType - WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌' - ]; + List<RecordType> rectHos = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌']; if (rectHos.size() == 0) { return; } @@ -293,6 +161,3 @@ Test.stopTest(); } } -======= -} ->>>>>>> LEXCommunityLiJun -- Gitblit v1.9.1