You need to sign in to do that
Don't have an account?
rupesh ranjan
Any one suggest for Test class for below constructor of main class
public class OSM_SW_TaxExemptionContactCtrl { private account primaryaccount ; public OSM_SW_TaxExemptionContactCtrl(){ Id recid = apexpages.currentpage().getparameters().get('accountid'); if(recid!=null){ primaryaccount = [select id,Customer_BMS_number__c,BOLT_Account_Number__c,IAM_Service_Provider_Code__c,BMS_Customer_ID__c,BMS_Customer_ID_Junction__c from account where id=:recid limit 1]; if(primaryaccount.Customer_BMS_number__c!=null){ CustomerNumber= primaryaccount.Customer_BMS_number__c; }else if(primaryaccount.BOLT_Account_Number__c!=null){ CustomerNumber= primaryaccount.BOLT_Account_Number__c; }else { CustomerNumber= primaryaccount.IAM_Service_Provider_Code__c; } } String myGeneratedFileName = 'Tax Exemption ContactForm.pdf'; Apexpages.currentPage().getHeaders().put('content-disposition', 'attachment; filename='+myGeneratedFilename); Apexpages.currentPage().getHeaders().put('content-disposition', 'inline; filename='+myGeneratedFilename); } ]
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_error_handling.htm
You have to create an account, set the page with the parameter (id of the account created) and after that you can validate the headers to see if everything worked out.
If it solved your issue please mark it as the correct answer, it may help others.
below code is not covering
Something like:
PageReference pageRef = --YOUR PAGE--;
Test.setCurrentPage(pageRef);
ApexPages.currentPage().getParameters().put('accountid', '--YOURID--');
Please let me know if this help you solve your issue