+ 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/