You need to sign in to do that
Don't have an account?
Carolyn juliana 7
How do i write test class for below apex code
Hi Gurus,
Please help me in writing test class for below apex code
Carolyn
Please help me in writing test class for below apex code
public class PickListHandler { @AuraEnabled public static List<String> getLevel1(string strName){ List<String> tempLst = new List<String>(); for(AggregateResult ar : [select Level_1__c,COUNT(id) from Case_Type_Data__c group by Level_1__c]) { tempLst.add('Level 1 data is'+ar.get('Level_1__c')); } return tempLst; } }Regards,
Carolyn
{
Case_Type_Data__c data = new Case_Type_Data__c();
data.Level_1__c="test";
Insert data;
List<String> s = PicklistHandler .getLevel1('test');
//System.assert(....);
}
All Answers
static testMethod void testGetLevel1()
{
List<String> s = PicklistHandler .getLevel1('test');
//System.assert(....);
}
{
Case_Type_Data__c data = new Case_Type_Data__c();
data.Level_1__c="test";
Insert data;
List<String> s = PicklistHandler .getLevel1('test');
//System.assert(....);
}