| | |
| | | private class NewRepairControllerTest { |
| | | static testMethod void testMethod1() { |
| | | //1. 准备数据 |
| | | TestDataUtility.CreatePIPolicyConfiguration(); |
| | | List<String> strList = new List<String>(); |
| | | strList.add('Repair__c'); |
| | | strList.add('Address__c'); |
| | | strList.add('Contact'); |
| | | strList.add('RepairSubOrder__c'); |
| | | strList.add('Repair__cV2'); |
| | | TestDataUtility.CreatePIPolicyConfigurations(strList); |
| | | Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock()); |
| | | Repair__c repTest = TestDataUtility.CreateRepairs(1)[0]; |
| | | //2. 运行代码逻辑 |
| | |
| | | strList.add('Address__c'); |
| | | strList.add('Contact'); |
| | | strList.add('RepairSubOrder__c'); |
| | | strList.add('Repair__cV2'); |
| | | TestDataUtility.CreatePIPolicyConfigurations(strList); |
| | | Test.setMock(HttpCalloutMock.class, new TestDataUtility.CreateMetaDataUtilityHttpMock()); |
| | | String url = ApexPages.currentPage().getParameters().put('00N10000006P6SM','北京'); |
| | |
| | | |
| | | |
| | | Repair__c repTest = TestDataUtility.CreateRepairs(1)[0]; |
| | | url = ApexPages.currentPage().getParameters().put('RepairId',repTest.Id); |
| | | url = ApexPages.currentPage().getParameters().put('retURL','%'+repTest.Id); |
| | | Test.startTest(); |
| | | ApexPages.StandardController con = new ApexPages.StandardController(new Repair__c()); |
| | | NewRepairController repDetail = new NewRepairController(con); |
| | | Test.stopTest(); |
| | | } |
| | | static testMethod void testMethod3(){ |
| | | TestDataUtility.CreatePIPolicyConfiguration('Repair__c'); |
| | | List<String> strList = new List<String>(); |
| | | strList.add('Repair__c'); |
| | | strList.add('Repair__cV2'); |
| | | strList.add('Contact'); |
| | | strList.add('Address__c'); |
| | | TestDataUtility.CreatePIPolicyConfigurations(strList); |
| | | ApexPages.StandardController con = new ApexPages.StandardController(new Repair__c()); |
| | | try{ |
| | | NewRepairController controllerTest = new NewRepairController(con); |
| | |
| | | }catch(Exception e){ |
| | | system.debug('Exception from insert repair:'+e.getMessage()); |
| | | } |
| | | |
| | | NewRepairController.EncryptUpdate('a0J1m000001QqX'); |
| | | NewRepairController.EncryptUpdate('a0J1m000001QqXk'); |
| | | } |