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
sfdc18sfdc18 

Test code coverage for Email Notification Trigger

Hi,

I am unable to get test code coverage for below code :
 
User c = [select Email,ManagerId from User where Id =:uc.OwnerId];
User u = [Select Email from User where Id =:c.ManagerId];
message.setTargetObjectId(c.Id);
message.setWhatId(uc.Id);
message.setSaveAsActivity(false);
message.setToAddresses(new String[] {u.Email});

Messaging.sendEmail(new Messaging.Email[] {message});
Regards,
Mayur
 
SonamSonam (Salesforce Developers) 
Check the following blog to get an idea:
http://blog.jeffdouglas.com/2008/10/15/how-to-unit-test-sending-mail-in-apex/