You need to sign in to do that
Don't have an account?
Padmini Sidugonde 6
SelectOption code coverage in test class
Hi,
I have written below code in Apex Class. But I am not able to cover this code coverage. Please help on this.
I have written below code in Apex Class. But I am not able to cover this code coverage. Please help on this.
public List<SelectOption> RelatedAccounts { get{ system.debug('ACCOUUNTS:' + Accs); List<SelectOption> options = new List<SelectOption>(); options.add(new selectOption('--Select--','')); for(CPF_Relationship__c r : Accs) { options.add(new SelectOption(r.id,r.child_account__r.name)); } return options; } }
Hi Padmini,
Please try this.
Please put your class in the plase of "YourControllerClassName "
YourControllerClassName toGetSelectOption = new YourControllerClassName();
List<SelectOption> selectOptionValuses = toGetSelectOption.RelatedAccounts;
Kindly let me know if it helps you and please mark as Best Answer.
Thanks and Regards,
Biswojeet
All Answers
Hi Padmini,
Please try this.
Please put your class in the plase of "YourControllerClassName "
YourControllerClassName toGetSelectOption = new YourControllerClassName();
List<SelectOption> selectOptionValuses = toGetSelectOption.RelatedAccounts;
Kindly let me know if it helps you and please mark as Best Answer.
Thanks and Regards,
Biswojeet
Account acc = new Account();
acc.Name ='Test';
insert acc ;
CPF_Relationship__c tem= new CPF_Relationship__c();
tem.child_account__c =acc.Id ;
insert tem ;
YourControllerClassName toGetSelectOption = new YourControllerClassName();
List<SelectOption> selectOptionValuses = toGetSelectOption.RelatedAccounts;
I have understand Your requirement.
Can you try above code it will resolve your issue.
Please let me know if it's helps you.
Thanks
Madhukar_Heptarc