From 744f42c5496e656a1f9927740a3b37c0b97a6cba Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 14:34:12 +0800
Subject: [PATCH] lexcommunityupload0714
---
force-app/main/default/classes/LexLicenceReminderControllerTest.cls | 323 +++++++++++++++++------------------------------------
1 files changed, 105 insertions(+), 218 deletions(-)
diff --git a/force-app/main/default/classes/LexLicenceReminderControllerTest.cls b/force-app/main/default/classes/LexLicenceReminderControllerTest.cls
index d3aded3..59ba1c8 100644
--- a/force-app/main/default/classes/LexLicenceReminderControllerTest.cls
+++ b/force-app/main/default/classes/LexLicenceReminderControllerTest.cls
@@ -1,226 +1,113 @@
@IsTest
private class LexLicenceReminderControllerTest {
- @IsTest
- static void testMethod1() {
- 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();
- System.runAs(currentUser) {
- LexLicenceReminderController.initReminder();
+ @IsTest
+ static void testMethod1(){
+ 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();
+ System.runAs(currentUser){
+ LexLicenceReminderController.initReminder();
+ }
+ Test.stopTest();
}
- Test.stopTest();
- }
- @IsTest
- static void testMethod2() {
- 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;
- }
+ @IsTest
+ static void testMethod2(){
+ 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');
+ 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();
+ }
- 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;
+ @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){
+ LexLicenceReminderController.initReminder();
+ }
+ Test.stopTest();
}
- 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;
+ @IsTest
+ static void testMethod4(){
+ 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(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){
+ LexLicenceReminderController.initReminder();
+ }
+ Test.stopTest();
}
- Test.startTest();
- System.runAs(myUser_test) {
- LexLicenceReminderController.initReminder();
- }
- Test.stopTest();
- }
-
- @IsTest
- static void testMethod4() {
- 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(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) {
- LexLicenceReminderController.initReminder();
- }
- Test.stopTest();
- }
-}
+}
\ No newline at end of file
--
Gitblit v1.9.1