You need to sign in to do that
Don't have an account?
testing pagereferences in assertEquals
I have the following code in one of the controller extension methods:
confirm() {
PageReference p = Page.offbsubmit;
p.setRedirect(true);
return p;
}
I am testing the above code in testMethod using the following statement..
PageReference q = test.confirm();
PageReference s = Page.offbsubmit;
system.assertEquals(q, s); // getting an exception here!!
I am getting the following exception:
System.Exception: Assertion Failed: Expected: System.PageReference[/apex/offbsubmit], Actual: System.PageReference[/apex/offbsubmit]
which doesnt make anysense to me because the expected and the actual values are the same..any help?
Hai
You can chk like below
system.assertEquals(q.getURL(), s.getURL());
Regards
Thanga
All Answers
Hai
You can chk like below
system.assertEquals(q.getURL(), s.getURL());
Regards
Thanga