You need to sign in to do that
Don't have an account?
Dan Dodd 3
APEX testing New Case controller extension
I found this How To Show HTML Email Right On Your Case Page (http://success.salesforce.com/ideaView?id=087300000007TOe) that really works great for what we want but cannot understand how to test it.
I need the email-to-case context where the case was generated by an email and test it pulling the data from emailMessage for this visualforce page.
public with sharing class CaseHTMLEmailController { private final Case caseObj; public String firstHTMLEmail { get {return getFirstHTMLEmail(); } } public CaseHTMLEmailController(ApexPages.StandardController stdController) { this.caseObj = (Case)stdController.getRecord(); } public String getFirstHTMLEmail() { EmailMessage firstEmail = [Select HtmlBody From EmailMessage where ParentId=:caseObj.Id order by LastModifiedDate asc limit 1]; if (firstEmail!=null) { return firstEmail.HtmlBody; } return ''; } }
I need the email-to-case context where the case was generated by an email and test it pulling the data from emailMessage for this visualforce page.
Use the below test class:
Thanks,
Maharajan.C
All Answers
https://salesforce.stackexchange.com/questions/159544/test-coverage-of-case-and-emailmessage-triggers
If it helps you please mark this answer as correct, it may help others.
Use the below test class:
Thanks,
Maharajan.C
Both answers very helpful.
Agustin B you pointed me to useful info with that link.
Maharajan.C. your code was almost drop in perfect.
Thanks to you both.
Dan
Instead of taking hours to figure out how to test Visualforce, I get to come here, do a quick copy+paste job and get on with my actual job instead of wrestling with SFDC's arduous requirements.
Thank you!