You need to sign in to do that
Don't have an account?

Test method for Attachment
Hello All,
I want to write a test method for a class but fail to cover some part because of BodyLength of Attachment object.
Here is some part of code,
.....................
if(objAttachment.BodyLength > 0)
{...................}
So could you help me how to set value for this BodyLength field.
Thanks,
Pratty
To set the body, you can create your own blob value, by doing something like
Blob myBlob = Blob.valueof('myTestValue');
and then assign myBlob as
atchmnt.Body = myBlob;