function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
I have written a test class and update the owner. You can change the code as per requirement.
@isTest
public class accountOwnerTest
{
static testMethod void testDiffOwner()
{
Account acc = new Account();
acc.Name = 'Test';
insert acc;
Test.startTest();
Profile p1 = [SELECT Id FROM Profile WHERE Name='System Administrator'];
User user1 = new User(Alias = 'stand', Email='standarduser@testorg.com',
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p1.Id,
TimeZoneSidKey='America/Los_Angeles', UserName='standarduser@testorg.com');
insert user1;
System.runAs(usr)
{
acc.ownerId = user1.id;
update acc;
}
Test.stopTest();
}
}
Please mark it as Best Answer if it helps you.
Thanks & Regards
Suraj Tripathi