@isTest private class StandardFieldDefaultsControllerTest{ static testMethod void initTest() { // 产品 Product2 pro1 = new Product2( Name='name01', IsActive=true, Asset_Model_No__c='n01', MDM_Model_No__c='n01', ProductCode_Ext__c='pc01', ProductCode = 'pc01', Manual_Entry__c=false, SFDA_Status__c='有効' ); insert pro1; Apexpages.currentPage().getParameters().put('Pagefrom', 'Product'); Apexpages.currentPage().getParameters().put('Pageto', 'LastbuyProduct'); StandardFieldDefaultsController controller = new StandardFieldDefaultsController(); controller.init(); } }