• Crusty
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I've built a simple trigger that will stop an update to a record based on a user's profile.  In building a test method for this trigger, I don't see any way to simulate both sides of the processing, since the logic in the trigger is dependant on the results of the getUserInfo calls. 
 
The issue, is how to get to 100% code coverage in a test method in this sort of situation?
 
What I'd like to be able to do in my test method is the following:
 
using my current admin login,
update 200 records  (These would succeed, as the admin profile is allowed to make the updates)
 
switch login to a non-admin user login
update 200 records (These would not succeed, and the addError would be applied to the appropriate fields)
 
Jon Keener