19626
2023-06-15 c376deadef754aa59c002386c2f3c98904be37f8
force-app/main/default/classes/NewQuoteEntryControllerTest.cls
@@ -78,6 +78,7 @@
    private static String agentName = 'test agent name';
    static testMethod void TestInit01() {
        StaticParameter.EscapeOppandStaTrigger = true;
        system.debug('---------------------------------------Start initTest-----');
        NewQuoteEntryController QuotePage = new NewQuoteEntryController();
        //Line 119 UserのQuote_Correct__c、Quote_Special_Operation__c、SAP_Send_OFF__cをテストため。
@@ -142,6 +143,7 @@
    }
    static testMethod void testInit02() {
        StaticParameter.EscapeOppandStaTrigger = true;
        system.debug('---------------------------------------Start initTest-----');
        Profile p = [select Id from Profile where id = :System.Label.ProfileId_SystemAdmin];
        User MacOwner = new User(Test_staff__c = true, Batch_User__c  = true, LastName = 'hp1', FirstName = 'owner1', Alias = 'hp', CommunityNickname = 'hpOwner1', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com1', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
@@ -203,6 +205,7 @@
    }
    static testMethod void testInit02_01() {
        StaticParameter.EscapeOppandStaTrigger = true;
        Profile p = [select Id from Profile where id = :System.Label.ProfileId_SystemAdmin];
        User MacOwner = new User(Test_staff__c = true, Batch_User__c  = true, LastName = 'hp1', FirstName = 'owner1', Alias = 'hp', CommunityNickname = 'hpOwner1', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com1', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        system.runAs(MacOwner) {
@@ -322,6 +325,7 @@
//     }
    static testMethod void testInit02_2_01() {
        StaticParameter.EscapeOppandStaTrigger = true;
        system.debug('---------------------------------------Start initTest-----');
        NewQuoteEntryController QuotePage = new NewQuoteEntryController();
        //Line 119 UserのQuote_Correct__c、Quote_Special_Operation__c、SAP_Send_OFF__cをテストため。
@@ -437,6 +441,8 @@
//     }
    static testMethod void testInit04() {
        ControllerUtil.EscapeNFM001Trigger = true;
        StaticParameter.EscapeOppandStaTrigger = true;
        Profile p = [select Id from Profile where id = :System.Label.ProfileId_SystemAdmin];
        User MacOwner = new User(Test_staff__c = true, Batch_User__c  = true, LastName = 'hp1', FirstName = 'owner1', Alias = 'hp', CommunityNickname = 'hpOwner1', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com1', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        system.runAs(MacOwner) {
@@ -504,6 +510,7 @@
        }
    }
    static testMethod void testInit04_01() {
        StaticParameter.EscapeOppandStaTrigger = true;
        Profile p = [select Id from Profile where id = :System.Label.ProfileId_SystemAdmin];
        User MacOwner = new User(Test_staff__c = true, Batch_User__c  = true, LastName = 'hp1', FirstName = 'owner1', Alias = 'hp', CommunityNickname = 'hpOwner1', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com1', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        system.runAs(MacOwner) {
@@ -561,6 +568,7 @@
    }
    static testMethod void testInit04_2() {
        StaticParameter.EscapeOppandStaTrigger = true;
        Profile p = [select Id from Profile where id = :System.Label.ProfileId_SystemAdmin];
        User MacOwner = new User(Test_staff__c = true, Batch_User__c  = true, LastName = 'hp1', FirstName = 'owner1', Alias = 'hp', CommunityNickname = 'hpOwner1', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com1', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        system.runAs(MacOwner) {
@@ -629,6 +637,7 @@
    }
    static testMethod void testInit04_2_01() {
        StaticParameter.EscapeOppandStaTrigger = true;
        NewQuoteEntryController QuotePage = new NewQuoteEntryController();
        String userId = UserInfo.getUserId();
        User u1 = [SELECT Id, Quote_Correct__c, Quote_Special_Operation__c, Cost_Referable__c FROM User WHERE Id = :userId];
@@ -676,10 +685,11 @@
        //見積データ検索
        opprtunity = [SElECT Id, Opportunity_no__c, CurrencyIsoCode FROM Opportunity WHERE Id = :opp.id];
        //test7( opp, quote , QuotePage);
        test7( opp, quote , QuotePage);
        System.Test.stopTest();
    }
    static testMethod void TestInit05() {
        StaticParameter.EscapeOppandStaTrigger = true;
        system.debug('---------------------------------------Start initTest-----');
        NewQuoteEntryController QuotePage = new NewQuoteEntryController();
        //Line 119 UserのQuote_Correct__c、Quote_Special_Operation__c、SAP_Send_OFF__cをテストため。
@@ -901,7 +911,7 @@
        delete quote;
        Product2 product1 = new Product2( Name = 'テスト商品');
        Product2 product1 = new Product2( Name = 'テスト商品', ProductCode = 'TST1000001', Asset_Model_No__c = 'TST1000001');
        insert product1;
        system.debug('##product.Id=[' + product1.Id + ']' );
@@ -978,7 +988,7 @@
//        delete quote;
            Product2 product1 = new Product2( Name = 'テスト商品');
            Product2 product1 = new Product2( Name = 'テスト商品', ProductCode = 'TST1101101', Asset_Model_No__c = 'TST1101101', LastbuyProductFLG__c = true);
            insert product1;
            system.debug('##product.Id=[' + product1.Id + ']' );
@@ -1005,6 +1015,7 @@
        }
    }
    static testMethod void check_QuoteEntryController001() {
        StaticParameter.EscapeOppandStaTrigger = true;
        RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType = 'Account' and Name = :RC_BYOUIN limit 1];
        Account hospital = new Account(Name = 'テスト病院');
@@ -1161,6 +1172,9 @@
            controller.quoId = null;
            controller.enableSales = false;
            controller.init();
            product2.Name = '11122';
            update product2;
            controller.init();
            controller.quo.MultiYearWarrantyTotalPrice__c = 1000;
            controller.dataCheck();
            controller.select_index = 0;
@@ -1242,6 +1256,7 @@
    }
    //测试程序 测外贸 精琢技术 wql 2021/02/20 start
    static testMethod void check_QuoteEntryController002() {
        StaticParameter.EscapeOppandStaTrigger = true;
        RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType = 'Account' and Name = :RC_BYOUIN limit 1];
        Account hospital = new Account(Name = 'テスト病院');
@@ -1269,7 +1284,7 @@
        system.runAs(MacOwner) {
            Opportunity opp = new Opportunity( Name = 'aiueo', StageName = 'contact', CloseDate = Date.today());
            opp.Trade__c = '外貿';
            opp.CurrencyIsoCode = CurrencyIso;
            opp.CurrencyIsoCode = 'USD';
            opp.Sales_Root__c = '販売店';
            opp.StageName = '引合';
            opp.owner_not_automatically_update__c = true;
@@ -1476,10 +1491,11 @@
            Apexpages.currentPage().getParameters().put('oppid', opp.id);
            NewQuoteEntryController controller = new NewQuoteEntryController();
            //Apexpages.currentPage().getParameters().put('id', quote.id);
            controller.oppId = null;
            controller.quoId = null;
            controller.oppId = opp.id;
            controller.quoId = quote.id;
            controller.enableSales = false;
            controller.init();
            controller.ReservedProductVerification();
            controller.quo.MultiYearWarrantyTotalPrice__c = 1000;
            controller.dataCheck();
            controller.select_index = 0;
@@ -1577,6 +1593,7 @@
    }
    static testMethod void dataEntryTest() {
        StaticParameter.EscapeOppandStaTrigger = true;
        Profile p = [select Id from Profile where id = :System.Label.ProfileId_SystemAdmin];
        User MacOwner = new User(Test_staff__c = true, Batch_User__c  = true, LastName = 'hp1', FirstName = 'owner1', Alias = 'hp', CommunityNickname = 'hpOwner1', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com1', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        system.runAs(MacOwner) {
@@ -1836,6 +1853,7 @@
       //测试阿西赛多 测试程序 精琢技术 wql 2021/02/20 start
    static testMethod void check_QuoteEntryController003() {
        StaticParameter.EscapeOppandStaTrigger = true;
        RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType = 'Account' and Name = :RC_BYOUIN limit 1];
        Account hospital = new Account(Name = 'テスト病院');
@@ -2104,6 +2122,7 @@
    //20211015 lt start
    static testMethod void check_QuoteEntryController004() {
        StaticParameter.EscapeOppandStaTrigger = true;
        RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType = 'Account' and Name = :RC_BYOUIN limit 1];
        Account hospital = new Account(Name = 'テスト病院');
@@ -2405,6 +2424,7 @@
    }
    static testMethod void dataEntryTest1() {
        StaticParameter.EscapeOppandStaTrigger = true;
        Profile p = [select Id from Profile where id = :System.Label.ProfileId_SystemAdmin];
        User MacOwner = new User(Test_staff__c = true, Batch_User__c  = true, LastName = 'hp1', FirstName = 'owner1', Alias = 'hp', CommunityNickname = 'hpOwner1', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com1', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
        system.runAs(MacOwner) {
@@ -2639,6 +2659,7 @@
            //controller.dataEntry();
            //controller.dataCheck();
            controller.QuoteDecision();
            controller.quoId = quote.id;
            controller.Print();
            actList = new List<NewQuoteEntryController.QELine>();
@@ -2676,6 +2697,7 @@
    }
    //20211015 lt end
    static testMethod void dataEntryTest2() {
        StaticParameter.EscapeOppandStaTrigger = true;
        RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType = 'Account' and Name = :RC_BYOUIN limit 1];
        Account hospital = new Account(Name = 'テスト病院');
        hospital.RecordTypeId = recByoin.id;