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
Rajiv B 3Rajiv B 3 

test code coverage issue for My attachment.


Hi , 

i am unable to get code coverage for the following. 
 
if (fileBody != null){
             
        myAttachment  = new Attachment();
              Integer i=0;
              myAttachment .clear();
              myAttachment.Body = fileBody; 
              myAttachment.Name = fileName; 
              myAttachment.ContentType = contentType;
              myAttachment.ParentId = objcase.id;             
              insert myAttachment;  
              }

 
Best Answer chosen by Rajiv B 3
Rajiv B 3Rajiv B 3
I am able to fix the issue.. thanks for your response @Amit.

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Please post your full apex class and Test class so that we can help you

NOTE:- in your test class you need to set fileBody
Rajiv B 3Rajiv B 3
I am able to fix the issue.. thanks for your response @Amit.
This was selected as the best answer