You need to sign in to do that
Don't have an account?
SANDEEP CHITTINENI
Thanks in Advance..........!
How to get code a code coverage for this below method ?
public void Find(){ //Filter for Carrier Type Only. if((cv.Carrier_Type__c == 'Allegian Choice' || cv.Carrier_Type__c == 'BCBS_MS' || cv.Carrier_Type__c == 'BCBS_MAPD' || cv.Carrier_Type__c == 'CareMore' || cv.Carrier_Type__c == 'CIGNA_IFP' || cv.Carrier_Type__c == 'Health Choice' || cv.Carrier_Type__c == 'Humana' || cv.Carrier_Type__c == 'Phoenix Choice' || cv.Carrier_Type__c == 'PHP_VBHP' || cv.Carrier_Type__c == 'UAHP') && (cv.AgentAgency_Type__c != 'Agent' && cv.AgentAgency_Type__c != 'Agency') && (cv.Activity__c != 'Active' && cv.Activity__c != 'Inactive')){ system.debug('Success'); CarrierAgent = [select id, Validation_Name__c, Approved_By__c, Activity__c from Carrier_Validation__c where Carrier_Type__c =: cv.Carrier_Type__c and AgentAgency_Type__c =: 'Agent']; system.debug('Success' +CarrierAgent); CarrierAgency = [select id, Validation_Name__c, Approved_By__c, Activity__c from Carrier_Validation__c where Carrier_Type__c =: cv.Carrier_Type__c and AgentAgency_Type__c =: 'Agency']; } //Filter for Carrier Type and Agent/Agency Type Only. else if((cv.Carrier_Type__c == 'Allegian Choice' || cv.Carrier_Type__c == 'BCBS_MS' || cv.Carrier_Type__c == 'BCBS_MAPD' || cv.Carrier_Type__c == 'CareMore' || cv.Carrier_Type__c == 'CIGNA_IFP' || cv.Carrier_Type__c == 'Health Choice' || cv.Carrier_Type__c == 'Humana' || cv.Carrier_Type__c == 'Phoenix Choice' || cv.Carrier_Type__c == 'PHP_VBHP' || cv.Carrier_Type__c == 'UAHP') && (cv.AgentAgency_Type__c == 'Agent' || cv.AgentAgency_Type__c == 'Agency') && (cv.Activity__c != 'Active' && cv.Activity__c != 'Inactive')){ CarrierAgent = [select id, Validation_Name__c, Approved_By__c, Activity__c from Carrier_Validation__c where Carrier_Type__c =:cv.Carrier_Type__c and (AgentAgency_Type__c =: cv.AgentAgency_Type__c and AgentAgency_Type__c =: 'Agent')]; CarrierAgency = [select id, Validation_Name__c, Approved_By__c, Activity__c from Carrier_Validation__c where Carrier_Type__c =:cv.Carrier_Type__c and (AgentAgency_Type__c =: cv.AgentAgency_Type__c and AgentAgency_Type__c =: 'Agency')]; } else if((cv.Carrier_Type__c == 'Allegian Choice' || cv.Carrier_Type__c == 'BCBS_MS' || cv.Carrier_Type__c == 'BCBS_MAPD' || cv.Carrier_Type__c == 'CareMore' || cv.Carrier_Type__c == 'CIGNA_IFP' || cv.Carrier_Type__c == 'Health Choice' || cv.Carrier_Type__c == 'Humana' || cv.Carrier_Type__c == 'Phoenix Choice' || cv.Carrier_Type__c == 'PHP_VBHP' || cv.Carrier_Type__c == 'UAHP') && (cv.AgentAgency_Type__c == 'Agent' || cv.AgentAgency_Type__c == 'Agency') && (cv.Activity__c == 'Active' || cv.Activity__c == 'Inactive')){ CarrierAgent = [select id, Validation_Name__c, Approved_By__c, Activity__c from Carrier_Validation__c where Carrier_Type__c =:cv.Carrier_Type__c and (AgentAgency_Type__c =: cv.AgentAgency_Type__c and AgentAgency_Type__c =: 'Agent') and (Activity__c =: cv.Activity__c)]; CarrierAgency = [select id, Validation_Name__c, Approved_By__c, Activity__c from Carrier_Validation__c where Carrier_Type__c =:cv.Carrier_Type__c and (AgentAgency_Type__c =: cv.AgentAgency_Type__c and AgentAgency_Type__c =: 'Agency') and (Activity__c =:cv.Activity__c)]; } //Filter for Activity Only. else if((cv.Carrier_Type__c != 'Allegian Choice' || cv.Carrier_Type__c != 'BCBS_MS' || cv.Carrier_Type__c != 'BCBS_MAPD' || cv.Carrier_Type__c != 'CareMore' || cv.Carrier_Type__c != 'CIGNA_IFP' || cv.Carrier_Type__c != 'Health Choice' || cv.Carrier_Type__c != 'Humana' || cv.Carrier_Type__c != 'Phoenix Choice' || cv.Carrier_Type__c != 'PHP_VBHP' || cv.Carrier_Type__c != 'UAHP') && (cv.AgentAgency_Type__c != 'Agent' && cv.AgentAgency_Type__c != 'Agency') && (cv.Activity__c == 'Active' || cv.Activity__c == 'Inactive')){ CarrierAgent = [select id, Validation_Name__c, Approved_By__c, Activity__c from Carrier_Validation__c where Activity__c =: cv.Activity__c and AgentAgency_Type__c =: 'Agent']; CarrierAgency = [select id, Validation_Name__c, Approved_By__c, Activity__c from Carrier_Validation__c where Activity__c =: cv.Activity__c and AgentAgency_Type__c =: 'Agency']; }
Thanks in Advance..........!
Following test record will satisfy first IF condition.
cv.Carrier_Type__c = 'Allegian Choice'
cv.AgentAgency_Type__c != 'Agent' && cv.AgentAgency_Type__c != 'Agency'
cv.Activity__c != 'Active' && cv.Activity__c != 'Inactive'
Following will satisfy first ELSE IF condition (or the second IF).
cv.Carrier_Type__c = 'Allegian Choice'
cv.AgentAgency_Type__c = 'Agent'
cv.Activity__c != 'Active' && cv.Activity__c != 'Inactive'
Following will satisfy second ELSE IF condition (or the third IF).
cv.Carrier_Type__c = 'Allegian Choice'
cv.AgentAgency_Type__c = 'Agent'
cv.Activity__c = 'Active'
Following will satisfy third ELSE IF condition (or the fourth IF).
cv.Carrier_Type__c = 'Allegian Choice'
cv.AgentAgency_Type__c != 'Agent' && cv.AgentAgency_Type__c != 'Agency'
cv.Activity__c = 'Active'
By the way, following piece of logic in fourth IF condition technically will not block any records. Because NOT_EQUAL_TO and OR conditions open up to much.
Hope this helps.