• dianass
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I am getting a system.assertEquals error on the following test class. Error: System.AssertException: Assertion Failed: Expected: null, Actual: 00580000001k6g1AAAClass.testReferralAssignOwner.test: line 11, column 1 Test Class: @isTest private class testReferralAssignOwner { static testMethod void test() { List testUsers = [select id from user where isactive = true limit 2]; Account a = new Account(Name='test'); insert a; List refs = new List(); refs.add(new Referral__c(Client_Name__c=a.id,Phone__c='12345',Assigned__c=testUsers[0].Id)); refs.add(new Referral__c(Client_name__c=a.id,Phone__c='12345',Assigned__c=testUsers[1].Id)); insert refs; system.assertEquals(refs[0].OwnerId,testUsers[0].Id); // OwnerId should equal Assigned__c; system.assertEquals(refs[1].OwnerId,testUsers[1].Id); // OwnerId should equal Assigned__c; refs[0].OwnerId = testUsers[1].Id; refs[1].Assigned__c = testUsers[0].Id; update refs; system.assertEquals(refs[0].Assigned__c,testUsers[1].Id); // Assigned__c should equal OwnerId now system.assertEquals(refs[1].OwnerId,testUsers[0].Id); // OwnerId should equal Assigned__c now } } It says that it is expecitng null and getting a user ID instead. It should be expecting the user ID, so I am not sure what the problem is. Any help is greatly appreciated!