buli
2023-07-14 e6068da47c1bef5517c9e5fdc8c726766867ad4e
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 = '販売店'
            ];
            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 = '販売店'];
            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 = '販売店'];
            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 = '販売店'];
            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 = '販売店'
            ];
            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 = '販売店'];
            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 = '販売店'];
            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 = '販売店'
            ];
            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 = '販売店'];
            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