@isTest public class TydelikeConControllerTest { static testMethod void testMethod1() { Account acctest = TestDataUtility.CreateAccounts(1)[0]; acctest.ProductSegment__c = 'BS'; update acctest; TydelikeContact__c tycotest = new TydelikeContact__c(); tycotest.Name = 'test'; tycotest.TyAddress__c = 'test'; tycotest.TyFaxD__c = 'test'; tycotest.TyPhoneD__c = '13566667777'; tycotest.TyPostcode__c = '5000000'; tycotest.EnglishAddress__c = 'test'; tycotest.ContactEnglishName__c = 'test'; insert tycotest; TydelikeAccount__c tyaccount = new TydelikeAccount__c(); String url = ApexPages.currentPage().getParameters().put('accName',acctest.Name); url = ApexPages.currentPage().getParameters().put('tycoId',tycotest.Id); url = ApexPages.currentPage().getParameters().put('tyacId',tyaccount.Id); Test.startTest(); TydelikeConController scc = new TydelikeConController(); scc.acc = acctest; scc.tya = tyaccount; scc.init(); scc.save(); acctest.ProductSegment__c = 'IE'; update acctest; scc.init(); acctest.ProductSegment__c = 'NDT'; update acctest; scc.init(); acctest.ProductSegment__c = 'ANI'; update acctest; scc.init(); acctest.ProductSegment__c = 'RVI'; update acctest; scc.init(); Test.stopTest(); } }