You need to sign in to do that
Don't have an account?

Constructor not defined in Test Class
Class is use override view record. I can open but Test Class not work !
public class genMembershipConditionsPDF{ public genMembershipConditionsPDF(ApexPages.StandardController controller) { gotoPDFPage(); } public Pagereference gotoPDFPage() { return new Pagereference('/apex/MembershipConditionsPDF?Id='+Apexpages.Currentpage().getParameters().get('Id')); } }
@isTest private class test_genMembershipConditionsPDF { static testMethod void myUnitTest() { Account Acc = new Account(); Acc.name = 'Test'; insert Acc; Membership_Conditions__c MC = new Membership_Conditions__c(); MC.Copy_of_organisational_structure__c = True; MC.OrganizationsID__c = Acc.id; MC.Designation__c = 'Test'; insert MC; ApexPages.StandardSetController controller = new ApexPages.StandardSetController(MC); genMembershipConditionsPDF sc = new genMembershipConditionsPDF(); PageReference S = sc.gotoPDFPage(); } }
Thank you so much.
Hi,
Your test method should be:
Also, as you are calling gotoPDFPage() method from constructor, you don't have to explicitly call.
Just a suggestion, instead of calling, gotoPDFPage() from the constructor, call the method from the <apex:page action="{!gotoPDFPage}"> for better performance.
Thanks
Sureka
All Answers
Hi,
Your test method should be:
Also, as you are calling gotoPDFPage() method from constructor, you don't have to explicitly call.
Just a suggestion, instead of calling, gotoPDFPage() from the constructor, call the method from the <apex:page action="{!gotoPDFPage}"> for better performance.
Thanks
Sureka
I'm Change but error
Constructor not defined: [ApexPages.StandardSetController].<Constructor>(SOBJECT:Membership_Conditions__c)
Test Class :
Page :
Thank you so much.
Hi,
Instead of "ApexPages.StandardSetController" use "ApexPages.StandardController"
Thanks
Sureka
OK ! this work .
OMG i'm Sacatterained.
Thank you so much Sureka.