function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SANDEEP CHITTINENISANDEEP CHITTINENI 

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..........! 
LBKLBK
In my assessment, you need to create four test records that satify the following conditions, to meet the required coverage.

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.
(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')
Because NOT_EQUAL_TO and OR conditions open up to much.

Hope this helps.
 
SANDEEP CHITTINENISANDEEP CHITTINENI
Thank you...! But I'm not getting code coverage.
LBKLBK
Can you post your Test class and the complete APEX controller class?