You need to sign in to do that
Don't have an account?
pls help me to cover the if else part in test class
my if else part is:
if (Acc.size() > 0)
{
for(GE_PW_User_Sales_Hierarchy_Association__c c : Acc) {
system.debug('parent:'+c.GE_PW_Parent_Location_ID__c);
if(Locationid.size()>0)
{
for(GE_PW_User_sales_Hierarchy_Association__c l : Locationid)
{
if(l.GE_PW_Location_ID__c==c.GE_PW_Parent_Location_ID__c)
{ status='Valid';
break;
//intcount++;
}
else
{
for(GE_PW_User_Sales_Hierarchy_Association__c a : Acc) {
if(c.GE_PW_Parent_Location_ID__c==a.GE_PW_Location_ID__c)
{
status='Valid';
break;
}
else
{
status='Invalid';
//intcount++;
}
}
}
}
}
pls help me to write the test class to cover it
You'll need to construct data in order to exercise the various conditional paths.
It looks like you'll need to have an instance of GE_PW_User_Sales_Hierarchy_Association__c in the accs collection whose location doesn't match an instance of GE_PW_User_sales_Hierarchy_Association__c in the LocationId collection.