GWY
2022-05-21 a3460549533111815e7f73d6cef601a58031525d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@isTest
private class SWOSearchProductContarollerTest {
    static testMethod void testMethod1() {
        List<RecordType> rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer IE'];
        List<RecordType> rectOpp = [select Id from RecordType where IsActive = true and SobjectType = 'Opportunity' and Name = 'SSBD'];
        Id pricebookId = Test.getStandardPricebookId();
        
        Pricebook2 pricebook = new Pricebook2(
            Name = 'IE',
            ProductSegment__c = 'IE',
            TradeType__c = 'Taxation',
            SalesChannel__c = 'direct',
            MachineParts__c = 'Machine',
            CurrencyIsoCode = 'CNY'
        );
        insert pricebook;
        
        Product2 product1 = new Product2();
        product1.Name = 'product1';
        product1.IsActive = true;
        product1.ProductCode = 'product1';
        product1.ProductStatus__c = '1';
        product1.NMPAStatus_one__c = 'Z1';
        product1.MaterialStatus_one_Start__c = Date.today().addDays(-22);
        product1.MaterialStatus_one_End__c = Date.today().addDays(22);
 
        insert product1;
 
        PageReference page = new PageReference('/apex/SWOSearchProduct?Type=Quotes&lineno=1&val=product1');
        System.Test.setCurrentPage(page);
        SWOSearchProductContaroller controller = new SWOSearchProductContaroller();
        controller.init();    
    }
}