You need to sign in to do that
Don't have an account?
mac admin
Test class for the extenstion class
Hi all,
Can anyone help in writting the test class for the below extension class.
public class gdaControllerExtension {
Public final GFrm__c gfrm;
public gdaControllerExtension (ApexPages.StandardController stdController) {
this.gfrm = (GFrm__c)stdController.getRecord();
}
public void mfarten()
{
if(gfrm.SelectProgram__c=='MA')
{
gfrm.Select_One_Art_Ed__c= null;
}else if(gform.SelectProgram__c=='AED'){
gfrm.SelectOne_MFA__c= null;
}else if(gfrm.SelectProgram__c=='enroll'){
gform.SelectOne_MFA__c= null;
}
}
}
Thanks in advace.
Regards,
mac.
Can anyone help in writting the test class for the below extension class.
public class gdaControllerExtension {
Public final GFrm__c gfrm;
public gdaControllerExtension (ApexPages.StandardController stdController) {
this.gfrm = (GFrm__c)stdController.getRecord();
}
public void mfarten()
{
if(gfrm.SelectProgram__c=='MA')
{
gfrm.Select_One_Art_Ed__c= null;
}else if(gform.SelectProgram__c=='AED'){
gfrm.SelectOne_MFA__c= null;
}else if(gfrm.SelectProgram__c=='enroll'){
gform.SelectOne_MFA__c= null;
}
}
}
Thanks in advace.
Regards,
mac.
Try this.
All Answers
Refer the below code:-
Please replace the values as per your suitability as I have considered values as per my understanding. Their data type may be different.
It should work for you if does not then please let me know.
Thanks for the reply, I was getting the below error.
Error: Compile Error: Method does not exist or incorrect signature: lstGF() at line 28 column 16
Can you please help me over here.
Getting error as below.
Error: Compile Error: Method does not exist or incorrect signature: System.assert(String, NULL) at line 40 column 9
Can you help me over here.
Try this.
While running test the methods are failed and showing the below error.
Error MessageSystem.DmlException: Insert failed. First exception on row 0; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, SelectOne(MFA): bad value for restricted picklist field: MFA Illustration: [SelectOne_MFA__c]
Stack TraceClass.gdaControllerExtensionTest.createTestData: line 28, column 1
Can you please help me why I'm facing this error.
Thanks in advance.
I've given test values and asked you to replace with the valid values because I was not aware of the type and values associated with those fields. So this error relates to this. Please replace the value of below fields with the valid values exists in the system:-
Name
Select_One_Art_Ed__c
SelectOne_MFA__c
It should work then..