You need to sign in to do that
Don't have an account?
newbiewithapex
How do I write test class method to cover If loop?
I am trying cover if loop from EventHandler class but I can't figurer out why this part of the code is not covered. Test class is way too long to post it here so can someone please help me with this?
if(eveRels !=null && eveRels.size()>0){ for(EventRelation eveRel : eveRels){ if(!test.isRunningTest()) { if(eveRel.Relation.type.equals('User')){ userRecptList.add(eveRel.RelationId); } if(eveRel.Relation.type.equals('Lead')){ leadRecptList.add(eveRel.RelationId); } if(eveRel.Relation.type.equals('Contact')){ contactRecptList.add(eveRel.RelationId); } } else { if(string.valueOf(eveRel.RelationId).startswith(User.SObjectType.getdescribe().getKeyPrefix())){ userRecptList.add(eveRel.RelationId); } if(string.valueOf(eveRel.RelationId).startswith(Lead.SObjectType.getdescribe().getKeyPrefix())){ leadRecptList.add(eveRel.RelationId); } if(string.valueOf(eveRel.RelationId).startswith(Contact.SObjectType.getdescribe().getKeyPrefix())){ contactRecptList.add(eveRel.RelationId); } } } }
Raj Vakati
Give me complete class ?
newbiewithapex