You need to sign in to do that
Don't have an account?
Joseph Pingleton
Test Class for simple Redirection
Hello,
I'm brand new to Apex and I'm hopeing someone can assist me in writing a simple test class for the below auto redirecting vf page:
VF Page
Controller
I truly won't be writing code much and I simply want to be able to push the apex class over to production. Any help with a test class would be greatly appreciated! Thanks!
I'm brand new to Apex and I'm hopeing someone can assist me in writing a simple test class for the below auto redirecting vf page:
VF Page
<apex:page controller="pagedirections" action="{!urlRedirection}"> </apex:page>
Controller
public class pagedirections { public PageReference urlRedirection() { string url = 'https://www.example.com/login?emailAddress=' + UserInfo.getUserEmail(); PageReference page = new PageReference(url); page.setRedirect(true); return page; } }
I truly won't be writing code much and I simply want to be able to push the apex class over to production. Any help with a test class would be greatly appreciated! Thanks!
Greetings!
You can simply use the assertion to check the url as mentioned in the below link:
https://developer.salesforce.com/forums/?id=9060G0000005lQqQAI
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri
Thanks!