You need to sign in to do that
Don't have an account?
Scott.M
ApexPages.addMessage throws Exception in Test Methods
Hi,
When writing test methods for visualforce page extensions, if there's a section of code inside the extension that creates an error message like the following:
Then salesforce throws the following exception:
System.Exception: ApexPages.addMessage can only be called from a Visualforce page, for now I'm getting arround it by wrapping it in a try catch and asserting that the error message is the expected one for ApexPages.addMessage, but I think it should be able to be called during a test.
When writing test methods for visualforce page extensions, if there's a section of code inside the extension that creates an error message like the following:
Code:
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL, 'Custom Error Message'));
Then salesforce throws the following exception:
System.Exception: ApexPages.addMessage can only be called from a Visualforce page, for now I'm getting arround it by wrapping it in a try catch and asserting that the error message is the expected one for ApexPages.addMessage, but I think it should be able to be called during a test.
Is there a public place to view acknowledge reported bugs?
Scott
Granted, I'm pretty new at Apex and VisualForce, so it's probably a newbie problem. Any ideas?
Thank you,
Jeri.
Thanks,