I'm attempting to run a test class for a custom Visualforce controller but am having an issue with my System.AssertEquals method.
Controller:
public without sharing class CC_LegalController {
public String Brand{get;set;}
public CC_LegalController() {
hasAcceptedTerms = false;
User thisUser = [select Id, AccountId, Brand__c from User where Id = :UserInfo.getUserId() ];
if(thisUser.Brand__c == 'Brand 1'){
Brand = 'Brand 1';
}else{
Brand = 'Brand 2';
}
}
public Boolean hasAcceptedTerms { get; set; }
public PageReference updateUser() {
update new User(Id=UserInfo.getUserId(), Accepted_Legal_Terms__c=hasAcceptedTerms);
return Page.CC_Home;
}
Test Class:
@IsTest global with sharing class CC_LegalController_TC {
@IsTest(SeeAllData=true)
global static void testCC_LegalController () {
CC_LegalController controller = new CC_LegalController();
System.assertEquals(Page.CC_Home, controller.updateUser());
}
}
The error message I am getting is "System.AssertException: Assertion Failed: Expected: System.PageReference[/apex/cc_home], Actual: System.PageReference[/apex/cc_home]"
... which looks equal to me. Any guesses as to what I'm missing? Thanks in advance for your assistance.