Please use the below code snippet in you case you have getter and setter methods in your apex class and want to cover up the same lines in test class.
Main Class:
Public class SreeTestCase { public List<SelectOption> caseStatusList { get { List<SelectOption> options = new List<SelectOption>(); for( Schema.PicklistEntry f : Case.Status.getDescribe().getPicklistValues()) { options.add(new SelectOption(f.getValue(), f.getLabel())); } return options; } set; } }
Test Class:
@isTest private class SreeTestCaseTestClass { static testMethod void testStatusList() { SreeTestCase st = new SreeTestCase(); List<SelectOption> options = new List<SelectOption>(); options = st.caseStatusList; } }
Please comment or write us if you have any queries/requirements.
Please comment or write us if you have any queries/requirements.
No comments:
Post a Comment