Following is code of my Test Class
- Where Asserts failed while deploying in Code into the Production.
I can change System.assert() to anything to avoid this.
But I want to know what I am doing wrong here -
Test class Code :
******* Created few users here user1, user2, user3,user4,etc.
Account testAcc = new Account();
testAcc.Name = 'Acc test DR';
testAcc.Phone = '5678797808';
testAcc.Channel_Description__c='asd';
testAcc.Channel_Code__c='qwe';
testAcc.Account_Status__c ='Active';
testAcc.recordTypeid = rtIdIRAccount;
testAcc.OwnerId = user1.Id; // **** notice this here
testAcc.MC2__c = true;
insert testAcc;
Case cs2 = new Case();
cs2.AccountId = testAcc.Id; //***** notice this here
cs2.origin = 'Phone';
cs2.Case_Source__c = 'Customer';
cs2.Status = IRConstants.CASE_NEW;
cs2.IsEscalated = false;
cs2.recordTypeId = npsClosedLoopRTID;
insert cs2;
system.assertEquals(user3.Id, [select ownerId from case where id = : cs2.Id].ownerId);
ERROR :
System.AssertException: Assertion Failed: Expected: 00519000000oBaXAAU, Actual: 00519000000oBaWAAU
Stack Trace: Class.MyTest.updateOwnerToAccountTeamMemeber_Test: line 543, column 1
not equals user1.id
so I know that some different owner was assigned to the user that I mocked