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
Praveen BonaluPraveen Bonalu 

Email services test class (Code Coverage Issue)

Hi every one,

I am not able to get the code coverage for the following test class.

Can anyone please help me  in code coverage.

I am not sure where i am doing wrong.

Please see below test class i have written for the Email services inbound handler.
@isTest
public class ProcessJobApplicantEmail_Test {
    
  
    static testMethod  void TestApplicant()
    {
         // Create a new email and envelope Object
        Messaging.InboundEmail email = new Messaging.InboundEmail();
        Messaging.InboundEnvelope env = new Messaging.InboundEnvelope();
        
        //setup the data for the email 
        email.subject='Test Job Application';
        email.fromname='Mike Villo';
        email.fromAddress='Test@gmail.com';
        
        //add an attachment 
        
        Messaging.InboundEmail.binaryAttachment attachment = new Messaging.InboundEmail.binaryAttachment();
        attachment.body=blob.valueOf('Test Job Application');
        attachment.filename='testfile.pdf';
        attachment.mimeTypeSubType = 'text/plain';
        
        email.binaryAttachments = new Messaging.inboundEmail.BinaryAttachment[] { attachment };
        
        ProcessJobApplicantEmail emailProcess = new ProcessJobApplicantEmail();
        emailProcess.handleInboundEmail(email, env);
  
             
        Candidate__c can =[select id, First_Name__c, Last_Name__c, Email__c from Candidate__c
         where First_Name__c = 'Mike' and Last_Name__c = 'Villo' and Email__c='Test@gmail.com' and Province__c='Ontario'];
        
        System.assertEquals(can.First_Name__c,'Mike');
        System.assertEquals(can.Last_Name__c,'Villo'); 
        System.assertEquals(can.Email__c,'Test@gmail.com');
        
        Attachment a = [select name from attachment where parentId = :can.id];
        System.assertEquals(a.name,'testfile.pdf');
    }

}