You need to sign in to do that
Don't have an account?

Unable to test a custom controller
I am trying to write unit test to test a class dealing with cookies and it is complaining that is can't find the variable Page.
Code:
PageReference page = new Page.Login; String zisession = '123'; Integer maxAge = 10000; Cookie ziSessionCookie = new Cookie(ZoomSessionManager.ZISESSION_COOKIE_NAME, zisession, null, maxAge, false); page.setCookies(new Cookie[]{ziSessionCookie}); Test.setCurrentPage(page);
IDE Error:
Save error: Variable does not exist: Page.Login
I followed the examples provieded by SalesForce but that clearly does not work out:
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_error_handling.htm
I should note that the test code is in a separate unit test class and the Page.Login does work fine in the destination class (ZoomSessionManager.cls), just doesn't exist in the unit test for some reason...
Any ideas what I might be doing wrong?
Thanks!
Is the page part of a different namespace?
hmm that is possible how can I check if that's the case?
I think it might be the same solution for the example above.
I was, like you, using the variable name 'page' for a PageReference variable (line 4). I think this messed with reference to Page.Login.
Test.setCurrentPageReference(pageRef);
LoginController lc = new LoginController();
PageReference page = lc.save();