You need to sign in to do that
Don't have an account?
shravani mil
Invalid conversion from runtime type Opportunity to Qill__c
error: at below line Invalid conversion from runtime type Opportunity to Qill__c
Test Class line:
ApexPages.StandardController sc = new ApexPages.standardController(testOppty);
Controller controller = new Controller(sc);
Class line:
this.q = (Qill__c)stdController.getRecord();
Test Class line:
ApexPages.StandardController sc = new ApexPages.standardController(testOppty);
Controller controller = new Controller(sc);
Class line:
this.q = (Qill__c)stdController.getRecord();
In test class you are passing Opportunity record and In your class you are using the Qill__c object.
ApexPages.StandardController sc = new ApexPages.standardController
(testOppty);So you Need to set Qill__c record into a standardController paramter So that the controller can be convert the object value into Qill__c type.
e.g.
ApexPages.StandardController sc = new ApexPages.standardController(QillRecord);
Create QillRecord or any other variable of Qill__c type and then pass to standard Controller.
If this post solves your problem kindly mark it as solution.
Thanks.