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
salesforce instancesalesforce instance 

can anyone help in writing the test class for the below code-not covering the code

global class SEMailSender {
    
         webservice static string CaseMergefields(String Emailbody,Case C){
            
              String textEmailbody=Emailbody;
              
                if(textEmailbody.Contains(SEConstants.CASENUMBERMERGE))
                    textEmailbody = textEmailbody.replace(SEConstants.CASENUMBERMERGE ,C.CaseNumber);
                    
                if(textEmailbody.Contains('{!Case.Subject}')){
                if(C.Subject!=null) 
                    textEmailbody = textEmailbody.replace('{!Case.Subject}' ,C.Subject);
                else
                    textEmailbody = textEmailbody.replace('{!Case.Subject}' ,SEConstants.BLANK);
                    
                }
                if(textEmailbody.Contains('{!Case.Description}')){
                    if(C.Description!=null)
                        textEmailbody = textEmailbody.replace('{!Case.Description}' ,C.Description);
                    else
                        textEmailbody = textEmailbody.replace('{!Case.Description}' ,SEConstants.BLANK);
                }
                    
                if(textEmailbody.Contains('{!Case.Solution_Description__c}')){
                    if(C.Solution_Description__c!=null)
                        textEmailbody = textEmailbody.replace('{!Case.Solution_Description__c}' ,C.Solution_Description__c);
                    else
                        textEmailbody = textEmailbody.replace('{!Case.Solution_Description__c}' ,SEConstants.BLANK);
                }
                    
                    
                if(textEmailbody.Contains('{!Case.External_Info_Long__c}')){
                    if(C.External_Info_Long__c!=null)
                        textEmailbody = textEmailbody.replace('{!Case.External_Info_Long__c}' ,C.External_Info_Long__c);
                    else
                        textEmailbody = textEmailbody.replace('{!Case.External_Info_Long__c}' ,SEConstants.BLANK);
                }
                if(textEmailbody.Contains('{!Case.Partner_Case_Ref__c}')){
                    if(C.Partner_Case_Ref__c!=null)
                        textEmailbody = textEmailbody.replace('{!Case.Partner_Case_Ref__c}' ,C.Partner_Case_Ref__c);
                   else
                        textEmailbody = textEmailbody.replace('{!Case.Partner_Case_Ref__c}' ,SEConstants.BLANK);
                }
                   
                if(textEmailbody.Contains('{!Case.Customer_Case_Ref__c}')){
                    if(C.Customer_Case_Ref__c!=null)
                        textEmailbody = textEmailbody.replace('{!Case.Customer_Case_Ref__c}' ,C.Customer_Case_Ref__c);
                    else
                        textEmailbody = textEmailbody.replace('{!Case.Customer_Case_Ref__c}' ,SEConstants.BLANK);   
                }
                if(textEmailbody.Contains('{!Case.SurveyLink__c}') && C.SurveyLink__c!=null)
                    textEmailbody = textEmailbody.replace('{!Case.SurveyLink__c}' ,C.SurveyLink__c);
            return textEmailbody;
        }

}